rails ActiveRecord validation on specific controller and action

前端 未结 3 1183
天涯浪人
天涯浪人 2021-02-06 09:09

is it possible to run ActiveRecord validates on given controller and action.

For example I have user_controller and signup_controller

I

3条回答
  •  孤城傲影
    2021-02-06 09:41

    use validates :password, :if => :password_changed? in user.rb

    if form in users_controller does not submit password field then you should be ok.

提交回复
热议问题