custom error message options

This commit is contained in:
Adam Meehan
2010-08-31 13:23:07 +10:00
parent 728439201d
commit 2f3efa2107
3 changed files with 36 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ module ValidatesTimeliness
begin
restriction_value = type_cast(evaluate_option_value(options[restriction], record))
unless value.send(RESTRICTIONS[restriction], restriction_value)
return record.errors.add(attr_name, restriction, :restriction => format_error_value(restriction_value))
return record.errors.add(attr_name, restriction, :message => options[:"#{restriction}_message"], :restriction => format_error_value(restriction_value))
end
rescue => e
unless ValidatesTimeliness.ignore_restriction_errors