Validation for non-negative integers and decimal values

Doesn’t this work?

validates :your_field, :numericality => { :greater_than_or_equal_to => 0 }

(guess for taxes following rule will be more correct:)

validates :your_field, :numericality => { :greater_than_or_equal_to => 0, :less_than_or_equal_to => 100 }

Leave a Comment