Class: SolidusFriendlyPromotions::Conditions::UserLoggedIn

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

Instance Method Summary collapse

Methods included from OrderLevelCondition

#applicable?, #level

Methods inherited from SolidusFriendlyPromotions::Condition

#applicable?, #eligibility_errors, #level, #preload_relations, #to_partial_path, #updateable?

Instance Method Details

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

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'app/models/solidus_friendly_promotions/conditions/user_logged_in.rb', line 8

def eligible?(order, _options = {})
  if order.user.blank?
    eligibility_errors.add(:base, eligibility_error_message(:no_user_specified), error_code: :no_user_specified)
  end
  eligibility_errors.empty?
end