Class: ActiveModel::Validations::TruthinessValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::TruthinessValidator
- Defined in:
- lib/validates_truthiness/validates_truthiness.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 |
# File 'lib/validates_truthiness/validates_truthiness.rb', line 4 def validate_each(record, attribute, value) record.errors.add(attribute, :truthiness, :message => [:message], :value => value) unless (value.is_a?(FalseClass) || value.is_a?(TrueClass)) end |