Displaying 1 result from an estimated 1 matches for "not_equal_to".
2008 Apr 04
6
validates_numericality_of :not_equal_to
I have a situation in which I want to validate a number is not zero.
Both positive and negative values are acceptable, just not zero.
validates_numericality_of has an :equal_to attribute, but I don''t see a
:not_equal_to. I have not yet been able to find anyone who has
discussed this. I did find information about custom validators, so I am
now using a custom validator to check the field and add an appropriate
error message.
Is there an easier way, ideally without using validates_format_of? It
seems like it would...