2009/11/16 Todd A. Jacobs <[email protected]>:
>
> On Mon, Nov 16, 2009 at 11:38:14AM +0000, Colin Law wrote:
>
>> Is it a string or numeric field in the db?
>
> It's an integer.
>

I think that is the problem, as noted earlier validates_length_of does
not really make much sense for an integer.  How many digits in 0123
for example?  It has four digits but will be stored in the db as 123
so will no longer have four digits when you read it back.  Use
validates_numericality_of, specifying a range, to check it is an
integer in the required range.  Whether integer is the right field
type for zipcode is another matter.  If you needed to go international
you would find that often they are not numbers.

Colin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to