阅读背景:

为什么Rails验证未更改的属性?

来源:互联网 

It seems that validates_uniqueness_of :some_field will run on a "save" even if the some_field attribute has not changed (if other fields have changed). This seems wasteful, since each validates_uniqueness_of will require a database call. I know I can pass a Proc to validates_uniqueness_of to check whether some_field has changed, and I am considering going through all the validations and doing that wherever possible. What I am wondering is:It seems that validates_uniqueness_of :some_fie




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: