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

Registration Name attribute is not stored #897

Closed
trepidity opened this issue May 29, 2017 · 1 comment
Closed

Registration Name attribute is not stored #897

trepidity opened this issue May 29, 2017 · 1 comment

Comments

@trepidity
Copy link

In this example, Name and Nickname are posted to the controller, but they are not written to the database.

Is this a bug or a parameter I'm missing?

devise (4.3.0)
devise_token_auth (0.1.42)
INFO -- : Started POST "/auth" for 162.158.69.81 at 2017-05-29 03:17:20 +0000
INFO -- : Processing by DeviseTokenAuth::RegistrationsController#create as HTML
INFO -- : Parameters: {"name"=>"jared jennings", "email"=>"jared@fake.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "nickname"=>"JJ", "registration"=>{"name"=>"jared jennings", "email"=>"jared@fake.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "nickname"=>"JJ"}}
DEBUG -- :    (0.8ms)  BEGIN
DEBUG -- :    (2.2ms)  SELECT COUNT(*) FROM "users" WHERE "users"."provider" = $1 AND "users"."email" = $2  [["provider", "email"], ["email", "jared@fake.com"]]
DEBUG -- :   SQL (1.1ms)  INSERT INTO "users" ("uid", "encrypted_password", "email", "tokens", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"  [["uid", "jared@fake.com"], ["encrypted_password", "$2a$1"], ["email", "jared@fake.com"], ["tokens", "{}"], ["created_at", "2017-05-29 03:17:20.407555"], ["updated_at", "2017-05-29 03:17:20.407555"]]
@trepidity
Copy link
Author

Never mind. I just needed to add the devise_parameter_santitizer statements.

class ApplicationController < ActionController::API
[...]
  before_action :configure_permitted_parameters, if: :devise_controller?

  protected

  def configure_permitted_parameters
    Rails.logger.info "in ApplicationController.rb configure_permitted_parameters!"
    devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :name, :nickname])
  end

end

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

1 participant