-3

I have used the 'Devise' gem provided by Rails to for user SignUp/Log In. By default it provides 'email', 'password' and 'password confirmation' fields. I wish to add more fields like 'Nickname', 'City', 'Company' etc and then also create a user profile page (Dashboard) which simply displays this information.

Can you please tell me in detail(at least mention the steps) as to how I can achieve this?

Eyeslandic
  • 14,553
  • 13
  • 41
  • 54

1 Answers1

0

As Iceman stated, you can find how to add parameters at https://github.com/plataformatec/devise. You will have to generate the views and edit the forms to include your parameters. Then the "lazy way" is too add the following code in your Application controller.

class ApplicationController < ActionController::Base
  before_action :configure_permitted_parameters, if: :devise_controller?

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
  end
end

To create a profile page, you can just add an action to one of your existing controllers or one of the devise controllers.

dazuma15
  • 21
  • 3