ccuilla
2008-May-11 02:13 UTC
validates_numericality_of and greater_than* doesn''t appear to be working
I''m using Rails 2.0.2 and I have been trying to take advantage of the "validates_numericality_of" with the ":greater_than" option with something like this: validates_numericality_of :users, :greater_than => 0, :only_integer => true, :allow_nil => true, :message => "The number of allowed users must be a whole number greater than zero." But this doesn''t seem to be catching values set to zero or negative values. Am I using this correctly? NOTE: I have the same problem with the "" option so I assume it is something generally I''m doing wrong. validates_numericality_of :value, :greater_than_or_equal_to => 0, :only_integer => true, :allow_nil => true, :message => "Cannot use a negative or fractional number." --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- validates_numericality_of with greater_than* less_than* simply don't work
- validates_numercality_of with allow_nil.
- ActiveRecord: When / where to validate data? Tricky question
- validates_numericality_of, :allow_nil => true?
- should validate_numericality_of with greater_than_or_equal_to