Sha256: 42a806f34fe11490b20d7c10702d24107b94c08a2a04fef6145f730ba9f06e4c

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

class CarrierTypeHasCheckoutType < ApplicationRecord
  scope :available_for_carrier_type, lambda {|carrier_type| includes(:carrier_type).where('carrier_types.name = ?', carrier_type.name)}
  scope :available_for_user_group, lambda {|user_group| includes(checkout_type: :user_groups).where('user_groups.name = ?', user_group.name)}

  belongs_to :carrier_type, validate: true
  belongs_to :checkout_type, validate: true

  validates :carrier_type, :checkout_type, presence: true
  validates_associated :carrier_type, :checkout_type
  validates :checkout_type_id, uniqueness: { scope: :carrier_type_id }

  acts_as_list scope: :carrier_type_id
end

# == Schema Information
#
# Table name: carrier_type_has_checkout_types
#
#  id               :bigint           not null, primary key
#  carrier_type_id  :bigint           not null
#  checkout_type_id :bigint           not null
#  note             :text
#  position         :integer
#  created_at       :datetime         not null
#  updated_at       :datetime         not null
#

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enju_circulation-0.4.0.rc.1 app/models/carrier_type_has_checkout_type.rb