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.”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs