Authenticate with additional user attributes
Justin Tomich edited this page May 17, 2017
·
3 revisions
To add additional attributes to your user model while using Authenticate's user controller:
- extend Authenticate::UsersController
- override #user_params, permitting the new attributes(s)
- optionally, update your users#new view
Extend Authenticate's users controller, and add your additional parameters to the user_params method.
# app/controllers/users_controller.rb
class UsersController < Authenticate::UsersController
private
def user_params
params[:user].permit(:email, :password, :custom_attributes)
end
end
To use your new controller, you'll need to add the route to your new create view.
# config/routes.rb
resources :users, controller: :users, only: :create
Add your updated view to app/views/users/new.html.erb
.