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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Change HABTM relations to has_many through (#11505)
Aleksandar Petrushev55d27ec8386c
diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rbindex f6a7f08a05..79aef5d0ef 100644--- a/core/app/models/spree/payment_method.rb+++ b/core/app/models/spree/payment_method.rb@@ -15,7 +15,8 @@ module Spreevalidates :name, presence: true- has_and_belongs_to_many :stores+ has_many :store_payment_methods, class_name: 'Spree::StorePaymentMethod'+ has_many :stores, class_name: 'Spree::Store', through: :store_payment_methodswith_options dependent: :restrict_with_error dohas_many :payments, class_name: 'Spree::Payment', inverse_of: :payment_methoddiff --git a/core/app/models/spree/promotion.rb b/core/app/models/spree/promotion.rbindex 4c75ff0408..d9dd4488d7 100644--- a/core/app/models/spree/promotion.rb+++ b/core/app/models/spree/promotion.rb@@ -19,7 +19,8 @@ module Spreehas_many :order_promotions, class_name: 'Spree::OrderPromotion'has_many :orders, through: :order_promotions, class_name: 'Spree::Order'- has_and_belongs_to_many :stores, class_name: 'Spree::Store', join_table: 'spree_promotions_stores'+ has_many :store_promotions, class_name: 'Spree::StorePromotion'+ has_many :stores, class_name: 'Spree::Store', through: :store_promotionsaccepts_nested_attributes_for :promotion_actions, :promotion_rules