Class: Spree::PromotionRule
- Inherits:
-
Base
- Object
- Base
- Spree::PromotionRule
show all
- Includes:
- Spree::Preferences::Persistable
- Defined in:
- app/models/spree/promotion_rule.rb
Overview
Base class for all promotion rules
Direct Known Subclasses
Spree::Promotion::Rules::FirstOrder, Spree::Promotion::Rules::FirstRepeatPurchaseSince, Spree::Promotion::Rules::ItemTotal, Spree::Promotion::Rules::MinimumQuantity, Spree::Promotion::Rules::NthOrder, Spree::Promotion::Rules::OneUsePerUser, Spree::Promotion::Rules::OptionValue, Spree::Promotion::Rules::Product, Spree::Promotion::Rules::Store, Spree::Promotion::Rules::Taxon, Spree::Promotion::Rules::User, Spree::Promotion::Rules::UserLoggedIn, Spree::Promotion::Rules::UserRole
Instance Method Summary
collapse
Instance Method Details
#actionable?(_line_item) ⇒ Boolean
This states if a promotion can be applied to the specified line item It is true by default, but can be overridden by promotion rules to provide conditions
29
30
31
|
# File 'app/models/spree/promotion_rule.rb', line 29
def actionable?(_line_item)
true
end
|
#applicable?(_promotable) ⇒ Boolean
19
20
21
|
# File 'app/models/spree/promotion_rule.rb', line 19
def applicable?(_promotable)
raise NotImplementedError, "applicable? should be implemented in a sub-class of Spree::PromotionRule"
end
|
#eligibility_errors ⇒ Object
33
34
35
|
# File 'app/models/spree/promotion_rule.rb', line 33
def eligibility_errors
@eligibility_errors ||= ActiveModel::Errors.new(self)
end
|
#eligible?(_promotable, _options = {}) ⇒ Boolean
23
24
25
|
# File 'app/models/spree/promotion_rule.rb', line 23
def eligible?(_promotable, _options = {})
raise NotImplementedError, "eligible? should be implemented in a sub-class of Spree::PromotionRule"
end
|
#preload_relations ⇒ Object
15
16
17
|
# File 'app/models/spree/promotion_rule.rb', line 15
def preload_relations
[]
end
|
#to_partial_path ⇒ Object
37
38
39
|
# File 'app/models/spree/promotion_rule.rb', line 37
def to_partial_path
"spree/admin/promotions/rules/#{model_name.element}"
end
|