Skip to content

Instantly share code, notes, and snippets.

@andreypronin
Created February 27, 2013 16:55
Show Gist options
  • Save andreypronin/5049487 to your computer and use it in GitHub Desktop.
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…
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
devise_for :users, :controllers => { :registrations => "registrations" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment