I'm going nuts with an error I'm getting every time I try to sing in/sing up on my web.
Heroku logs:
Started GET "/users/sign_in" for 201.235.89.150 at 2016-07-06 01:35:03 +0000
Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)
NoMethodError (undefined method `for' for #<Devise::ParameterSanitizer:0x007f5968e0a920>):
app/controllers/application_controller.rb:11:in `configure_permitted_parameters'
application_controller.rb
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :provider, :uid) }
devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :current_password) }
end
end
The thing is it is working fine locally. It´s just on Heroku. And also it was working just fine a couple of days ago.
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :email])
devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :phone, :email, bank_attributes: [:bank_name, :bank_account]])
end
end
"The .for method is deprecated in 4.1 +
The first arg is the action name. :sign_up is for creating new Devise resources (such as users), and :account_update is for editing/updating the resource.
The second arg, :keys contains an array of the parameters you allow.
If you want nested_attributes, there is an example in :account_update, you put a separate array in with the key being _attributes."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With