My fields are:
tax rate
and tax amount
in which I want to validate positive values.
I wrote this validation:
:format => { :w
You could use:
validates :tax_rate, inclusion: { in: 0..5 }
It allows values like: 0, 2, 1.2, 3.2
Hope it helps!
you could use validates_numericality_of :amount, :greater_than => 0.0
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 }