Instantly share code, notes, and snippets.

Embed
What would you like to do?
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, :reset_password_token)
end
private :resource_params
end
# app/controllers/users/registrations_controller.rb
class Users::RegistrationsController < Devise::RegistrationsController
def resource_params
params.require(:user).permit(:current_password, :email, :name, :password, :password_confirmation)
end
private :resource_params
end
# config/routes.rb
devise_for :users, :controllers => {:passwords => "users/passwords", :registrations => "users/registrations", :sessions => "users/sessions"}
# app/controllers/users/sessions_controller.rb
class Users::SessionsController < Devise::SessionsController
def resource_params
params.permit(:user).permit(:email, :password)
end
private :resource_params
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment