Class: Spree::Promotion::Rules::Store

Inherits:
Spree::PromotionRule show all
Defined in:
app/models/spree/promotion/rules/store.rb

Instance Method Summary collapse

Methods inherited from Spree::PromotionRule

#actionable?, #eligibility_errors, for, #to_partial_path

Methods inherited from Base

display_includes

Methods included from Core::Permalinks

#generate_permalink, #save_permalink

Instance Method Details

#applicable?(promotable) ⇒ Boolean

Returns:

  • (Boolean)

12
13
14
# File 'app/models/spree/promotion/rules/store.rb', line 12

def applicable?(promotable)
  promotable.is_a?(Spree::Order)
end

#eligible?(order, _options = {}) ⇒ Boolean

Returns:

  • (Boolean)

16
17
18
# File 'app/models/spree/promotion/rules/store.rb', line 16

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