I''m not sure what I''m doing wrong here... validates_length_of :login, :within => 3..40, :message => "Some error message." The error message sent ends up being "Login is too short (min is 3 characters)". WTF? ___________________ Ben Jackson Diretor de Desenvolvimento ben-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org http://www.incomumdesign.com
I had the same problem and I had to divide it into to. One with minimum and one with maximum. According to documentation when you use within you are suppose to use to_short and to_long for messages and it still does not work for me. So one solution is to divide them up. Maybe someone can suggest a better solution. On 29-May-05, at 1:38 PM, Ben Jackson wrote:> I''m not sure what I''m doing wrong here... > validates_length_of :login, :within => 3..40, :message => "Some > error message." > The error message sent ends up being "Login is too short (min is 3 > characters)". WTF? > ___________________ > Ben Jackson > Diretor de Desenvolvimento > > ben-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > http://www.incomumdesign.com > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Ben Jackson wrote:> I''m not sure what I''m doing wrong here... > validates_length_of :login, :within => 3..40, :message => "Some error > message." > The error message sent ends up being "Login is too short (min is 3 > characters)". WTF?This is a known bug. Wait for the next AR release (which fixes it) -- Best regards, Alexey Verkhovsky Ruby Forum: http://ruby-forum.org (moderator) RForum: http://rforum.andreas-s.net (co-author) Instiki: http://instiki.org (maintainer)
John, It''s too_long not to_long. And too_short, not to_short. Change the line as follows and it will work. validates_length_of :login, :within => 3..40, :too_long => "pick a shorter login name", :too_short => "pick a longer login name" - Stephan