Created
February 27, 2013 16:55
-
-
Save andreypronin/5049487 to your computer and use it in GitHub Desktop.
Devise with strong_parameters. In prep to Rails 4, I'm using strong_parameters gem in my Rails 3.2.x apps. Though I'm aware about the Rails 4 support work going on for devise, I want to use it now with 3.2.x but in the 'Rails 4'-ish situation when you need to call 'permit' on 'params'. Solution: use custom RegistrationController with the followi…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RegistrationsController < Devise::RegistrationsController | |
def resource_params | |
permit_keys = [ :password, :password_confirmation ] + resource_class.authentication_keys | |
params.require(resource_name).permit( *permit_keys ) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devise_for :users, :controllers => { :registrations => "registrations" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment