Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
StrongParameters with Devise
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
# app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
def resource_params
params.require(:user).permit(:name, :email, :password, :password_confirmation)
end
private :resource_params
end
# config/routes.rb
devise_for :users, :controllers => {:registrations => "users/registrations", :passwords => "users/passwords"}
@nfedyashev

Thank you!

@he9lin

I had to add reset_password_token as one of the arguments

@ethier

Thanks for this.

@dannyko

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

app/controllers/users/passwords_controller.rb

@earnold

Thank you for this! :+1:

@apeacox

I did some changes to handle multiple resources (eg: User and Admin): https://gist.github.com/apeacox/5245821

@bluemont

The rails4 branch of Devise has some recent changes that are important for this discussion. See: plataformatec/devise@3ed0dc5 Or just view the README: https://github.com/plataformatec/devise/tree/rails4#strong-parameters

I made a Gist showing the code I use: https://gist.github.com/bluemont/e304e65e7e15d77d3cb9

@istana

thanks for the update

@pawel2105

Thanks!

@deneuxa

Thanks ! :)

@albrow

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.

@mastfish

I've made a gist based on the lazy suggestion for devise that handles multiple models at https://gist.github.com/mastfish/5702796 .

It saves having to create custom controllers.

@rusllonrails

Thanks )

@Abkreno

Thanks :+1:

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.