validates_length_of :message not working

I have the following code:

validates_length_of :city, :within => 1…30, :message
=> “Your city can’t be blank”

But the error message keeps showing the default message “City
is too short (minimum is 1 characters)”. It works fine if I set
:too_short and :too_long but that’s extra coding (I’m picky with

Any idea why this might be?



Try putting parentheses around 1…30.

validates_length_of :city, :within => (1…30), :message => “Your city can’t be blank”


no such luck....same result.

I just looked at the API and your original line looks like it should work. The configuration options state that message is an alias of too_long/too_short.

What happens if you just remove the message like this:

validates_length_of :city, :within => 1…30

In that case the default too_long/too_short messages are supposed to kick in.


ya according to the API it's *supposed* to work... hence my confusion.


it IS working, just not how I'd expect. the :message isn't being used
when I provide a :within attribute

any other ideas why :message is not working?