Class: DailyAffirmation::Validators::AbsenceValidator

Inherits:
DailyAffirmation::Validator show all
Defined in:
lib/daily_affirmation/validators/absence_validator.rb

Overview

This affirmation ensures an attribute is not present.

Instance Method Summary collapse

Methods inherited from DailyAffirmation::Validator

#affirm, #initialize

Constructor Details

This class inherits a constructor from DailyAffirmation::Validator

Instance Method Details

#error_messageObject



12
13
14
15
16
# File 'lib/daily_affirmation/validators/absence_validator.rb', line 12

def error_message
  @error_message ||= i18n_error_message(
    :absence, :default => "#{attribute} must be blank"
  )
end

#valid?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/daily_affirmation/validators/absence_validator.rb', line 8

def valid?
  @valid ||= !PresenceValidator.new(object, attribute).valid?
end