From 8f9a68027237a30c2452233c593fe83917fc2c84 Mon Sep 17 00:00:00 2001 From: LengTech11 Date: Mon, 25 Nov 2024 13:02:11 +0700 Subject: [PATCH] close #2080 fix bug taxon reposition not work --- app/models/spree_cm_commissioner/taxon_decorator.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) 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