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.

Don't try to add resource to Store if that Store is already associated

Damian Legawiec0940e43f6cb9
diff --git a/backend/app/controllers/spree/admin/resource_controller.rb b/backend/app/controllers/spree/admin/resource_controller.rb
index 375e5da17b..199691165e 100644
--- a/backend/app/controllers/spree/admin/resource_controller.rb
+++ b/backend/app/controllers/spree/admin/resource_controller.rb
@@ -207,7 +207,7 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController
if @object.has_attribute?(:store_id)
@object.store = current_store
- elsif model_class.method_defined?(:stores)
+ elsif model_class.method_defined?(:stores) && @object.stores.exclude?(current_store)
@object.stores << current_store
end
end