pdfshop/app/models/shipping.rb

23 lines
620 B
Ruby

# == Schema Information
#
# Table name: shippings
#
# id :integer not null, primary key
# name :string(255) not null
# price :decimal(10, 2) not null
# default :boolean default(FALSE), not null
# active :boolean default(TRUE), not null
# created_at :datetime
# created_by :bigint(8)
# updated_at :datetime
# updated_by :bigint(8)
#
# shipping class
class Shipping < ApplicationRecord
has_many :orders
scope :by_default, -> { where(default: true) }
scope :available, -> { where(active: true) }
scope :by_name_asc, -> { order('name ASC') }
end