当答案更新时,我试图在答案模型中验证分数是否大于零.这是我到目前为止所拥有的.
validates :score,:greater_than => 0,:on => :update@H_404_3@
但是,我收到此错误:
Unknown validator: 'greater_than'@H_404_3@
我找到了more_than验证器here.感谢您的帮助.
试试这个:
validates :score,:numericality => {:greater_than => 0},:on => :update@H_404_3@
原文链接:https://www.f2er.com/ruby/267537.html