Created — forked from guilleiguaran/passwords_controller.rb

Embed URL


SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

StrongParameters with Devise

View passwords_controller.rb
1 2 3 4 5 6 7 8
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
private :resource_params
View passwords_controller.rb
1 2 3 4 5 6 7 8
# app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
def resource_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
private :resource_params
View passwords_controller.rb
1 2 3
# config/routes.rb
devise_for :users, :controllers => {:registrations => "users/registrations", :passwords => "users/passwords"}

Thank you!

I had to add reset_password_token as one of the arguments

Thanks for this.

the comment "# app/controllers/users/password_controller.rb" should read


Thank you for this! :+1:

I did some changes to handle multiple resources (eg: User and Admin):

The rails4 branch of Devise has some recent changes that are important for this discussion. See: Or just view the README:

I made a Gist showing the code I use:

istana commented

thanks for the update


deneuxa commented

Thanks ! :)

albrow commented

Checkout @sferik's fork if you are using recoverable or want to let users change their password...
better version

You need to add a few more params to the list or else you will get errors. Saved me some trouble.

I've made a gist based on the lazy suggestion for devise that handles multiple models at .

It saves having to create custom controllers.

Thanks )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.