Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unknown validator even though it is in the Rails Guide on validators and callbacks

I am trying to validate that scores are greater than zero in my answer model when an answer is updated. Here is what i have so far.

validates :score, :greater_than => 0, :on => :update

However, i am getting this error:

Unknown validator: 'greater_than'

I found the greater_than validator here. Thanks for your help.

like image 823
Jay Avatar asked Aug 08 '11 13:08

Jay


1 Answers

Try this:

validates :score, :numericality => {:greater_than => 0}, :on => :update 
like image 73
dexter Avatar answered Nov 14 '22 19:11

dexter