I'm using strong parameters gem on small project with devise
I have added User.rb
a locale
column. This is my controllers/users/registrations_controller.rb
file:
class Users::RegistrationsController < Devise::RegistrationsController
def resource_params
params.require(:user).permit(:username, :email, :password, :password_confirmation, :locale)
end
private :resource_params
def create
#add params[:locale] to resource.locale here
super
end
end
These are the parameters received from form:
Parameters: {"authenticity_token"=>"ZyrtToHcwsX3zl2ive93cpYaom6HNGA/jnYcSg7pQUQ=", "user"=>{"username"=>"hyperrjas@hyperrjas.com", "email"=>"email@email.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create account", "locale"=>"es"}
I would like add to user :locale column
the parameter params[:locale]
How can I do it?
Thanks!