Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Change after_save hook to after_update, because on create, this update is not necessary. Additionally, these updates on create cause issues with translations (such as spree_globalize or spree_mobility)

mrbrdo65c5162e92af
diff --git a/core/app/models/spree/taxon.rb b/core/app/models/spree/taxon.rb
index 677657d584..d4be621e82 100644
--- a/core/app/models/spree/taxon.rb
+++ b/core/app/models/spree/taxon.rb
@@ -42,7 +42,7 @@ module Spree
before_validation :copy_taxonomy_from_parent
after_save :touch_ancestors_and_taxonomy
- after_save :sync_taxonomy_name
+ after_update :sync_taxonomy_name
after_touch :touch_ancestors_and_taxonomy
has_one :icon, as: :viewable, dependent: :destroy, class_name: 'Spree::TaxonImage'
diff --git a/core/app/models/spree/taxonomy.rb b/core/app/models/spree/taxonomy.rb
index f889164260..4af1ae5437 100644
--- a/core/app/models/spree/taxonomy.rb
+++ b/core/app/models/spree/taxonomy.rb
@@ -15,7 +15,7 @@ module Spree
belongs_to :store, class_name: 'Spree::Store'
after_create :set_root
- after_save :set_root_taxon_name
+ after_update :set_root_taxon_name
default_scope { order("#{table_name}.position, #{table_name}.created_at") }