Sha256: d176253b95213d302238dc8e141e19c85c874160d189290fadc16244941104cb

Contents?: true

Size: 608 Bytes

Versions: 4

Compression:

Stored size: 608 Bytes

Contents

# frozen_string_literal: true

module SolidusFriendlyPromotions
  module Conditions
    class Store < Condition
      include OrderLevelCondition

      has_many :condition_stores, class_name: "SolidusFriendlyPromotions::ConditionStore",
        foreign_key: :condition_id,
        dependent: :destroy
      has_many :stores, through: :condition_stores, class_name: "Spree::Store"

      def preload_relations
        [:stores]
      end

      def eligible?(order, _options = {})
        stores.none? || stores.include?(order.store)
      end

      def updateable?
        true
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_friendly_promotions-1.9.3 app/models/solidus_friendly_promotions/conditions/store.rb
solidus_friendly_promotions-1.9.2 app/models/solidus_friendly_promotions/conditions/store.rb
solidus_friendly_promotions-1.9.1 app/models/solidus_friendly_promotions/conditions/store.rb
solidus_friendly_promotions-1.9.0 app/models/solidus_friendly_promotions/conditions/store.rb