Class: DailyAffirmation::Validators::PresenceValidator

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

Overview

This affirmation ensures an attribute is 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


11
12
13
14
15
# File 'lib/daily_affirmation/validators/presence_validator.rb', line 11

def error_message
  @error_message ||= i18n_error_message(
    :presence, :default => "#{attribute} can't be blank"
  )
end

#valid?Boolean

Returns:

  • (Boolean)

7
8
9
# File 'lib/daily_affirmation/validators/presence_validator.rb', line 7

def valid?
  @valid ||= present?
end