
dm-validations package is silently broken by string interpolation issue
Reported by Dawid Marcin Grzesiak | December 18th, 2009 @ 03:54 PM
Hi,
I have a problem with validations when I turn $DEBUG flag
on.
I receive this exception: ArgumentError "too many arguments for
format string".
In ruby when you run this code everything is ok:
"%s must be an integer" % ["Area", /\A[+-]?\d+\z/]
but try this:
$DEBUG=true; "%s must be an integer" % ["Area", /\A[+-]?\d+\z/]
The problem is in the context of:
dm-validations-0.10.2/lib/dm-validations/validation_errors.rb
def self.default_error_message(key, field, values)
field = Extlib::Inflection.humanize(field)
@@default_error_messages[key] % [field, values].flatten # BUG
end
I've provided specs patch.
Kind regards,
Dawid
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »