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.

Enable bypassing last store validation (#11587)

Aleksandar Petrushev3df852d248ad
diff --git a/core/app/models/spree/store.rb b/core/app/models/spree/store.rb
index 1529a37f4d..0c0685af48 100644
--- a/core/app/models/spree/store.rb
+++ b/core/app/models/spree/store.rb
@@ -16,6 +16,8 @@ module Spree
s.integer :digital_asset_link_expire_time, default: 300, null: false # 5 minutes in seconds
end
+ attr_accessor :skip_validate_not_last
+
MAILER_LOGO_CONTENT_TYPES = ['image/png', 'image/jpg', 'image/jpeg'].freeze
FAVICON_CONTENT_TYPES = ['image/png', 'image/x-icon', 'image/vnd.microsoft.icon'].freeze
@@ -103,7 +105,7 @@ module Spree
before_save :ensure_default_exists_and_is_unique
before_save :ensure_supported_currencies, :ensure_supported_locales, :ensure_default_country
- before_destroy :validate_not_last
+ before_destroy :validate_not_last, unless: :skip_validate_not_last
before_destroy :pass_default_flag_to_other_store
scope :by_url, ->(url) { where('url like ?', "%#{url}%") }