diff --git a/app/models/spree_cm_commissioner/taxon_decorator.rb b/app/models/spree_cm_commissioner/taxon_decorator.rb index a727ce6cd..9a3189c1b 100644 --- a/app/models/spree_cm_commissioner/taxon_decorator.rb +++ b/app/models/spree_cm_commissioner/taxon_decorator.rb @@ -25,18 +25,9 @@ def self.prepended(base) 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, class_name: 'Spree::Taxon', foreign_key: :parent_id, dependent: :destroy - base.has_many :children_classifications, through: :children, source: :classifications, class_name: 'Spree::Classification' + base.acts_as_list scope: :parent_id - 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.validates_associated :category_icon base.before_save :set_kind base.before_save :set_slug @@ -53,6 +44,8 @@ def foreground_color preferred_foreground_color end + private + def set_kind self.kind = taxonomy.kind end