Module: Store::MultiStoreMethods
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/spree/store/multi_store_methods.rb
Constant Summary collapse
- RESERVED_CODES =
%w( admin default app api www cdn files assets checkout account auth login user )
Instance Method Summary collapse
- #can_be_deleted? ⇒ Boolean
- #import_payment_methods_from_store ⇒ Object
- #import_products_from_store ⇒ Object
Instance Method Details
#can_be_deleted? ⇒ Boolean
45 46 47 |
# File 'app/models/concerns/spree/store/multi_store_methods.rb', line 45 def can_be_deleted? self.class.where.not(id: id).any? end |
#import_payment_methods_from_store ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'app/models/concerns/spree/store/multi_store_methods.rb', line 58 def import_payment_methods_from_store store = Spree::Store.find(import_payment_methods_from_store_id) payment_method_ids = store.payment_method_ids return if payment_method_ids.empty? Spree::StorePaymentMethod.insert_all(payment_method_ids.map { |payment_method_id| { store_id: id, payment_method_id: payment_method_id } }) end |
#import_products_from_store ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'app/models/concerns/spree/store/multi_store_methods.rb', line 49 def import_products_from_store store = Spree::Store.find(import_products_from_store_id) product_ids = store.products.pluck(:id) return if product_ids.empty? Spree::StoreProduct.insert_all(product_ids.map { |product_id| { store_id: id, product_id: product_id } }) end |