Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign Up Permitted Parameters gets Passed but Never saves succesfully to Database #688

Closed
neilhanekom opened this issue Jul 28, 2016 · 3 comments

Comments

@neilhanekom
Copy link

I am adding Nickname, Name and a Role field to the new user registration Parameter. This new added Parameters I passed show up in my Rails console. As seen below the SQL Insert State shows the following.

SQL (23.3ms) INSERT INTO "users" ("name", "nickname", "email", "encrypted_password", "role_id", "tokens", "uid", "created_at", "updated_at", "confirmation_token", "confirmation_sent_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING "id" [["name", "Neil Hanekom"], ["nickname", "Neil"], ["email", "neilhanekom1@gmail.com"], ["encrypted_password", "$2a$10$z/Jpz8shRfXa9E46O70uk.F6NLNVXcqmSKLkFs6i/e1w39soYOwKS"], ["role_id", 1], ["tokens", "{}"], ["uid", "neilhanekom1@gmail.com"], ["created_at", "2016-07-28 15:31:45.666805"], ["updated_at", "2016-07-28 15:31:45.666805"], ["confirmation_token", "JJzkE_2B6yWPrNhg43HC"], ["confirmation_sent_at", "2016-07-28 15:31:45.667027"]]

However the new Parameters never gets saved. Why would this happen??

@ziazek
Copy link

ziazek commented Sep 8, 2016

Having the same issue here

@ziazek
Copy link

ziazek commented Sep 17, 2016

This worked for me:

In base_controller.rb:

# ...
include DeviseTokenAuth::Concerns::SetUserByToken
prepend_before_filter :configure_permitted_parameters, if: :devise_controller?

protected

def configure_permitted_parameters
  devise_parameter_sanitizer.for(:sign_up) << :name
  ## duplicate the line
  # devise_parameter_sanitizer.for(:sign_up) << :nickname
  # devise_parameter_sanitizer.for(:sign_up) << :role
end
# ...

@zachfeldman
Copy link
Contributor

Workaround posted, closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants