Class: KindValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- KindValidator
- Defined in:
- lib/kind/validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/kind/validator.rb', line 48 def validate_each(record, attribute, value) return if [:allow_nil] && value.nil? return unless error = call_validation_for(attribute, value) raise Kind::Error.new("#{attribute} #{error}") if [:strict] record.errors.add(attribute, error) end |