class ActiveModel::Validations::WithValidator

Public Instance Methods

validate_each(record, attr, val) click to toggle source
# File lib/active_model/validations/with.rb, line 12
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