开发者

Rails 3 & validate_on_create

Rails 3 warns me that validate_on_cre开发者_Go百科ate is deprecated. I have def validate_on_create in one of my models. What do I replace it with?


You can use:

validates :name, :presence => true, :on => :create

If you have a method that performs validations, you should run as:

validate :method_name, :on => :create
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜