4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'app/models/spree_cm_commissioner/taxon_decorator.rb', line 4
def self.prepended(base)
base.include SpreeCmCommissioner::TaxonKind
base.include SpreeCmCommissioner::Transit::TaxonBitwise
base.preference :background_color, :string
base.preference :foreground_color, :string
base.has_many :taxon_vendors, class_name: 'SpreeCmCommissioner::TaxonVendor'
base.has_many :vendors, through: :taxon_vendors
base.has_many :guest_card_classes, class_name: 'SpreeCmCommissioner::GuestCardClass'
base.has_many :homepage_section_relatables,
class_name: 'SpreeCmCommissioner::HomepageSectionRelatable',
dependent: :destroy, as: :relatable
base.has_many :user_events, class_name: 'SpreeCmCommissioner::UserEvent'
base.has_many :users, through: :user_events, class_name: Spree.user_class.to_s
base.has_many :products, through: :classifications, class_name: 'Spree::Product'
base.has_many :guests, foreign_key: :event_id, class_name: 'SpreeCmCommissioner::Guest', dependent: :nullify
base.has_many :check_ins, as: :checkinable, class_name: 'SpreeCmCommissioner::CheckIn', dependent: :nullify
base.has_many :customer_taxons, class_name: 'SpreeCmCommissioner::CustomerTaxon'
base.has_one :category_icon, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonCategoryIcon'
base.has_one :web_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonWebBanner'
base.has_one :app_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonAppBanner'
base.has_one :home_banner, as: :viewable, dependent: :destroy, class_name: 'SpreeCmCommissioner::TaxonHomeBanner'
base.has_many :children, -> { order(:lft) }, class_name: 'Spree::Taxon', foreign_key: :parent_id, dependent: :destroy
base.has_many :children_classifications, through: :children, source: :classifications, class_name: 'Spree::Classification'
base.has_many :notification_taxons, class_name: 'SpreeCmCommissioner::NotificationTaxon'
base.has_many :customer_notifications, through: :notification_taxons, class_name: 'SpreeCmCommissioner::CustomerNotification'
base.has_many :visible_classifications, -> { where(visible: true).order(:position) }, class_name: 'Spree::Classification'
base.has_many :visible_products, through: :visible_classifications, class_name: 'Spree::Product', source: :product
base.belongs_to :vendor, class_name: 'Spree::Vendor'
base.validates_associated :category_icon
base.before_save :set_kind
base.before_save :set_slug
base.whitelisted_ransackable_attributes |= %w[kind]
base.enum purchasable_on: { both: 0, web: 1, app: 2 }
end
|