Class: BetterValidations::NestedValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/better_validations/nested_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attr_name, value) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/better_validations/nested_validator.rb', line 2

def validate_each(record, attr_name, value)
  return if value.nil?

  validator = value
  return if validator_valid?(validator)

  add_errors(validator, record, attr_name)
end