When using e.g.
validates_numericality_of :budget, :allow_nil=> true, :less_than=>1000000000, :message => "smaller than %d"
%d is not replaced in the custom message but it is on the default ruby message "must be less than %d"
this can be fixed by changing line
record.errors.add(attr_name, configuration[:message]
(ActiveRecord::Errors.default_error_messages[option] % configuration[option])) unless raw_value.method(ALL_NUMERICALITY_CHECKS[option])[configuration[option]]
in validates_numericality_of (line 865 of Revision 9055)
to:
record.errors.add(attr_name, (configuration[:message] % configuration[option]) | (ActiveRecord::Errors.default_error_messages[option] % configuration[option])) unless raw_value.method(ALL_NUMERICALITY_CHECKS[option])[configuration[option]]
hope this helps.
/Michael
Attachments
Change History
Download in other formats:
|