On Nov 16, 6:10 am, "Todd A. Jacobs" <tjacobs-sndr-
b4f...@codegnome.org> wrote:
> On Sun, Nov 15, 2009 at 09:17:01PM -0800, Rick wrote:
> > Sure the code you've got matches what you've reported?
>
> Yup. I did some googling around, and other people have apparently had
> problems validating the length of numbers with validates_length_of as
> well. No one seems to have filed a bug report about it, though.
>
> I ended up replacing the validations with validates_format_of, and
> that's working for now. I'll file a bug report in the next day or so,
> since validates_length_of should either "just work," or be documented as
> being only for strings.

The length of a number isn't really a well defined concept (to me at
least), For example is 1236548 a number of length 7 (because it has 7
decimal digits, of length 6 because in hex it requires 6 digits or 3
because its binary representation has 3 bytes? If what you really want
is a range of numbers then validates_numericality_of has options like
greater_than and greater_than

Fred
>
> --
> "Oh, look: rocks!"
>         -- Doctor Who, "Destiny of the Daleks"
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to