This project is archived and is in readonly mode.
validates_length_of does not accept custom messages when :within used
Reported by Serdar Soydemir | September 16th, 2008 @ 01:57 PM | in 2.x
validates_length_of does not accept custom messages when :within or :in used. Instead it shows standard error message.
Code to reproduce
validates_length_of :mobile,
:in => 10..20,
:on => :create,
:message => "Sample: 5329999999"
using :minimum and :maximum instead of :in works fine anyway
This is on 2.1.1
Comments and changes to this ticket
-
Emilio Tagua September 16th, 2008 @ 02:39 PM
- Tag changed from 2.1, activerecord, validation to 2.1, activerecord, patch, validation
Here is the patch to add custom message to vlo when using :in or :within option.
-
Emilio Tagua September 16th, 2008 @ 03:21 PM
Edge patch, since this is actually not working on edge either.
-
Pratik December 20th, 2008 @ 07:25 PM
- Assigned user set to Pratik
- State changed from new to incomplete
Hey Emilio,
That looks good. I think we need to have a test case for :within as well.
Catch me in IRC and we'll get this going.
Thanks!
-
Emilio Tagua January 29th, 2009 @ 05:59 PM
Pratik,
As we spoke in IRC some time ago the :within tests is redundant since it's an alias from :in.
-
Pratik January 29th, 2009 @ 06:05 PM
- State changed from incomplete to open
- Assigned user changed from Pratik to Michael Koziarski
-
Repository February 1st, 2009 @ 02:02 AM
- State changed from open to committed
(from [2b8be761e476c103e94f8567c3880ea7363dfec0]) validate_length_of should use custom message if given when using in or within.
Signed-off-by: Michael Koziarski michael@koziarski.com [#1057 state:committed] http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 1057 validates_length_of does not accept custom messages when :within used Signed-off-by: Michael Koziarski michael@koziarski.com [#...