Skip to content

Instantly share code, notes, and snippets.

@Nursultan91
Created September 1, 2016 12:55
Show Gist options
  • Save Nursultan91/7c7b3b3e065ab1e487e6bd52a44f14e0 to your computer and use it in GitHub Desktop.
Save Nursultan91/7c7b3b3e065ab1e487e6bd52a44f14e0 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :password_confirmation, :remember_me])
devise_parameter_sanitizer.permit(:sign_in, keys: [:username, :email, :password, :password_confirmation, :remember_me])
devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :remember_me])
end
end
@Nursultan91
Copy link
Author

    class ApplicationController < ActionController::Base
      # Prevent CSRF attacks by raising an exception.
      # For APIs, you may want to use :null_session instead.
      protect_from_forgery with: :exception
      before_action :configure_permitted_parameters, if :devise_controller?

      protected
        def configure_permitted_parameters
          devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :password_confirmation, :remember_me])
          devise_parameter_sanitizer.permit(:sign_in, keys: [:username, :email, :password, :password_confirmation, :remember_me])
          devise_parameter_sanitizer.permit(:account_update, keys: [:email, :password, :password_confirmation, :remember_me])
        end

    end

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