简体   繁体   中英

Saving User Data without Password - Devise

I'm trying to save a user's data from an admin account on my site, but I receive the error that the current password can't be blank after the form submits. Here is the form I'm using:

= form_for @user, url: { action: 'update', controller: 'devise/registrations'}, method: :put do |f|

It would work successfully if it did not validate the user first.

you can use this in application_controller.rb as its mention in devise doc

  protected

    def configure_permitted_parameters
      devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :role, :email, :password])
      devise_parameter_sanitizer.permit(:account_update, keys: [:email,:#foo, :bar])
    end

you can modify your column name for signup and update action for devise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM