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开发者_Go百科 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.
Try this:
validates :score, :numericality => {:greater_than => 0}, :on => :update
精彩评论