Class: Spree::Promotion::Rules::NthOrder Private
- Inherits:
-
Spree::PromotionRule
- Object
- ActiveRecord::Base
- Base
- Spree::PromotionRule
- Spree::Promotion::Rules::NthOrder
- Defined in:
- app/models/spree/promotion/rules/nth_order.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
-
#applicable?(promotable) ⇒ Boolean
private
This promotion is applicable to orders only.
-
#eligible?(order, _options = {}) ⇒ Boolean
private
This is never eligible if the order does not have a user, and that user does not have any previous completed orders.
Methods inherited from Spree::PromotionRule
#actionable?, #eligibility_errors, for
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
Methods included from Spree::Preferences::Preferable
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#applicable?(promotable) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This promotion is applicable to orders only.
11 12 13 |
# File 'app/models/spree/promotion/rules/nth_order.rb', line 11 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, _options = {}) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is never eligible if the order does not have a user, and that user does not have any previous completed orders.
Use the first order rule if you want a promotion to be applied to the first order for a user.
20 21 22 23 24 |
# File 'app/models/spree/promotion/rules/nth_order.rb', line 20 def eligible?(order, = {}) return false unless order.user nth_order?(order) end |