Determine from the given condition (whether a block, procedure, method or
string) whether or not to validate
the record. See #validates_each.
# File activerecord/lib/active_record/validations.rb, line 348
def evaluate_condition(condition, record)
case condition
when Symbol; record.send(condition)
when String; eval(condition, record.send(:binding))
else
if condition_block?(condition)
condition.call(record)
else
raise(
ActiveRecordError,
"Validations need to be either a symbol, string (to be eval'ed), proc/method, or " +
"class implementing a static validation method"
)
end
end
end