Class: SolidusFriendlyPromotions::Conditions::User

Inherits:
SolidusFriendlyPromotions::Condition show all
Includes:
OrderLevelCondition
Defined in:
app/models/solidus_friendly_promotions/conditions/user.rb

Instance Method Summary collapse

Methods included from OrderLevelCondition

#applicable?, #level

Methods inherited from SolidusFriendlyPromotions::Condition

#applicable?, #eligibility_errors, #level, #to_partial_path

Instance Method Details

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

Returns:

  • (Boolean)


18
19
20
# File 'app/models/solidus_friendly_promotions/conditions/user.rb', line 18

def eligible?(order, _options = {})
  users.include?(order.user)
end

#preload_relationsObject



14
15
16
# File 'app/models/solidus_friendly_promotions/conditions/user.rb', line 14

def preload_relations
  [:users]
end

#updateable?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/models/solidus_friendly_promotions/conditions/user.rb', line 30

def updateable?
  true
end

#user_ids_stringObject



22
23
24
# File 'app/models/solidus_friendly_promotions/conditions/user.rb', line 22

def user_ids_string
  user_ids.join(",")
end

#user_ids_string=(user_ids) ⇒ Object



26
27
28
# File 'app/models/solidus_friendly_promotions/conditions/user.rb', line 26

def user_ids_string=(user_ids)
  self.user_ids = user_ids.to_s.split(",").map(&:strip)
end