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
Added `Spree::IntegrationsConcern` (#12684)
Damian Legawiec7b805fdabe29
diff --git a/core/app/models/concerns/spree/integrations_concern.rb b/core/app/models/concerns/spree/integrations_concern.rbnew file mode 100644index 0000000000..10212591e4--- /dev/null+++ b/core/app/models/concerns/spree/integrations_concern.rb@@ -0,0 +1,11 @@+module Spree+ module IntegrationsConcern+ def store_integrations+ @store_integrations ||= Spree::Store.current.integrations.active.to_a+ end++ def store_integration(name)+ store_integrations.find { |integration| integration.type.to_s.demodulize.underscore == name }+ end+ end+enddiff --git a/core/app/models/spree/base.rb b/core/app/models/spree/base.rbindex 9ddd705155..391351cfc4 100644--- a/core/app/models/spree/base.rb+++ b/core/app/models/spree/base.rb@@ -2,6 +2,7 @@ class Spree::Base < ApplicationRecordinclude Spree::Preferences::Preferableinclude Spree::RansackableAttributesinclude Spree::TranslatableResourceScopes+ include Spree::IntegrationsConcernafter_initialize doif has_attribute?(:preferences) && !preferences.nil?diff --git a/core/app/models/spree/shipment_handler.rb b/core/app/models/spree/shipment_handler.rbindex 8486ebc5c1..5776f13c1e 100644--- a/core/app/models/spree/shipment_handler.rb+++ b/core/app/models/spree/shipment_handler.rb@@ -1,6 +1,7 @@module Spreeclass ShipmentHandlerinclude Spree::Shipment::Emails+ include Spree::IntegrationsConcernclass << selfdef factory(shipment)