Devise 3 (rails 4) can't update user without password

前端 未结 7 1100
萌比男神i
萌比男神i 2021-02-06 00:34

I\'m trying to update a user without having to provide a password, but approaches that worked on older devise/rails versions no longer work with devise 3 and rails 4 strong para

7条回答
  •  太阳男子
    2021-02-06 01:33

    As of 2014, you can simply override a protected method and do:

    class RegistrationsController < Devise::RegistrationsController
    
      protected
    
      def update_resource(resource, params)
        resource.update_without_password(params)
      end
    end
    

提交回复
热议问题