Sha256: df9ed9afe65cd1223204f2b9f05b89c119ebbe1f3b4b7ae95aa55bf7ecfc7f15

Contents?: true

Size: 992 Bytes

Versions: 12

Compression:

Stored size: 992 Bytes

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               :integer          not null, primary key
#  carrier_type_id  :integer          not null
#  checkout_type_id :integer          not null
#  note             :text
#  position         :integer
#  created_at       :datetime
#  updated_at       :datetime
#

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.10 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.9 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.8 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.7 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.4.0.beta.4 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.4.0.beta.3 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.6 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.4.0.beta.2 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.4.0.beta.1 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.5 app/models/carrier_type_has_checkout_type.rb
enju_circulation-0.3.4 app/models/carrier_type_has_checkout_type.rb