Class: DailyAffirmation::Validators::ConfirmationValidator
- Inherits:
-
DailyAffirmation::Validator
- Object
- DailyAffirmation::Validator
- DailyAffirmation::Validators::ConfirmationValidator
- Defined in:
- lib/daily_affirmation/validators/confirmation_validator.rb
Overview
This affirmation ensures a related attribute *_confirmation has the same value.
Instance Method Summary collapse
Methods inherited from DailyAffirmation::Validator
Constructor Details
This class inherits a constructor from DailyAffirmation::Validator
Instance Method Details
#error_message ⇒ Object
12 13 14 15 16 |
# File 'lib/daily_affirmation/validators/confirmation_validator.rb', line 12 def @error_message ||= ( :confirmation, :default => "#{attribute} doesn't match confirmation" ) end |
#valid? ⇒ Boolean
8 9 10 |
# File 'lib/daily_affirmation/validators/confirmation_validator.rb', line 8 def valid? @valid ||= value == object.send("#{attribute}_confirmation") end |