简体   繁体   中英

NoMethodError: private method `permit' called for #<Devise::ParameterSanitizer

I had my application up and running on heroku but suddenly it stopped working and when i checked the logs it says

NoMethodError: private method `permit' called for #< Devise::ParameterSanitizer

I had the following function in application_controller.rb for 5 months never caused error except now

def configure_permitted_parameters
  devise_parameter_sanitizer.permit(:sign_up, keys: [:name , :account,:first_name, :last_name])
end

Can anyone help me on this ???

UPDATE I forgot to mention that everything works fine on localhost

Try

def configure_devise_permitted_parameters
  registration_params = [:name , :account,:first_name, :last_name]

  if params[:action] == 'create'
    devise_parameter_sanitizer.for(:sign_up) do
      |u| u.permit(registration_params)
    end
  end
end

This may help you

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