Rails 3 - Devise : How to skip the 'current_password' when editing a registration?

前端 未结 5 2006
无人共我
无人共我 2021-01-30 18:53

I\'ve implemented omniauth with my devise model, so I can authenticate using other services. Password is not necessary anymore for my model, as users can authenticate using twit

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 19:37

    The following worked for me:

    In my users controller, in the update action, I have

    params[:user].delete(:password) if params[:user][:password].blank?
    params[:user].delete(:password_confirmation) if params[:user][:password_confirmation].blank?
    

    Perhaps you could adapt that to a before_save callback?

提交回复
热议问题