Class: Spree::Promotion::Rules::User
Instance Method Summary
collapse
#actionable?, #eligibility_errors, #to_partial_path
Methods inherited from Base
display_includes
#generate_permalink, #save_permalink
Instance Method Details
#applicable?(promotable) ⇒ Boolean
16
17
18
|
# File 'app/models/spree/promotion/rules/user.rb', line 16
def applicable?(promotable)
promotable.is_a?(Spree::Order)
end
|
#eligible?(order, _options = {}) ⇒ Boolean
20
21
22
|
# File 'app/models/spree/promotion/rules/user.rb', line 20
def eligible?(order, _options = {})
users.include?(order.user)
end
|
#preload_relations ⇒ Object
12
13
14
|
# File 'app/models/spree/promotion/rules/user.rb', line 12
def preload_relations
[:users]
end
|
#user_ids_string ⇒ Object
24
25
26
|
# File 'app/models/spree/promotion/rules/user.rb', line 24
def user_ids_string
user_ids.join(',')
end
|
#user_ids_string=(user_ids) ⇒ Object
28
29
30
|
# File 'app/models/spree/promotion/rules/user.rb', line 28
def user_ids_string=(user_ids)
self.user_ids = user_ids.to_s.split(',').map(&:strip)
end
|