Skip to content

Instantly share code, notes, and snippets.

@mastfish
Last active December 18, 2015 01:19
Show Gist options
  • Save mastfish/5702796 to your computer and use it in GitHub Desktop.
Save mastfish/5702796 to your computer and use it in GitHub Desktop.
Strong parameters with devise
class ApplicationController < ActionController::Base
before_filter :define_resource_params, if: :devise_controller?
protected
def define_resource_params
if ((self.class <= Devise::PasswordsController) || (self.class <= Devise::RegistrationsController))
self.class.send(:define_method, :resource_params) do
params.require(resource_name).permit(:email, :password, :password_confirmation)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment