Sha256: 9a63a4d42b773dcc6177aa391eabcb8c6d0f140d3d9776cc47c56b385eec85b9

Contents?: true

Size: 445 Bytes

Versions: 13

Compression:

Stored size: 445 Bytes

Contents

module SpreeMultiDomain::LineItemConcerns
  extend ActiveSupport::Concern

  class ProductDoesNotBelongToStoreError < StandardError; end

  included do
    prepend(InstanceMethods)
    before_create :ensure_product_belongs_to_store
  end

  module InstanceMethods
    private

    def ensure_product_belongs_to_store
      raise ProductDoesNotBelongToStoreError if order.store.present? && !product.stores.include?(order.store)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
solidus_multi_domain-1.5.0 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.4.3 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.4.2 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.4.1 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.4.0 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.3.0 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.2.0 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.1.3 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.1.2 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.1.1 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.0.3 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.1.0 app/models/spree_multi_domain/line_item_concerns.rb
solidus_multi_domain-1.0.1 app/models/spree_multi_domain/line_item_concerns.rb