Skip to content

Instantly share code, notes, and snippets.

@drumusician
Last active May 19, 2018 22:31
Show Gist options
  • Save drumusician/438a99f0b846f03442db7ddd17f0e512 to your computer and use it in GitHub Desktop.
Save drumusician/438a99f0b846f03442db7ddd17f0e512 to your computer and use it in GitHub Desktop.
Devise add custom permitted params #rails #devise

Add as a Controller Concern

module DeviseWhitelist
  include ActiveSupport::Concern
  
  included do
    before_filer :configure_permitted_params, if devise_controller?
  end
  
  def configure_permitted_params
    devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
    devise_parameter_sanitizer.permit(:account_update, keys: [:name])
  end
end

Then include this concern in application_controller.rb:

include DeviseWhitelist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment