Method: ActiveModel::Validations::WithValidator#validate_each

Defined in:
activemodel/lib/active_model/validations/with.rb

#validate_each(record, attr, val) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'activemodel/lib/active_model/validations/with.rb', line 8

def validate_each(record, attr, val)
  method_name = options[:with]

  if record.method(method_name).arity == 0
    record.send method_name
  else
    record.send method_name, attr
  end
end