Skip to content

Commit 8f5f4ff

Browse files
committed
Move Taxon -> Promotion Rule association to legacy promotions
This was forgotten when extracting the legacy_promotions gem. Also adds a dependent: :destroy.
1 parent 97c9bda commit 8f5f4ff

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

core/app/models/spree/taxon.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class Taxon < Spree::Base
1313
has_many :classifications, -> { order(:position) }, dependent: :delete_all, inverse_of: :taxon
1414
has_many :products, through: :classifications
1515

16-
has_many :promotion_rule_taxons
17-
has_many :promotion_rules, through: :promotion_rule_taxons
18-
1916
before_save :set_permalink
2017
after_update :update_child_permalinks, if: :saved_change_to_permalink?
2118

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
module SolidusLegacyPromotions
4+
module SpreeTaxonPatch
5+
def self.prepended(base)
6+
base.has_many :promotion_rule_taxons, dependent: :destroy
7+
base.has_many :promotion_rules, through: :promotion_rule_taxons
8+
end
9+
10+
::Spree::Taxon.prepend self
11+
end
12+
end

0 commit comments

Comments
 (0)