/ devise

Overriding Devise User Session Path

I am currently working on a new project with a fellow Rubyist and we decided to run with Devise on this adventure. We wanted to use a custom path that would redirect an authenticated user to their Dashboard page where all their information would be displayed. Anyone that has used Devise knows that it is quite possible to facilitate such a need by overriding and inheriting from the Devise controllers. In this situation that kind of overhead was completely necessary.

In order to overcome this problem I began doing some research on how to get by going through the mess of overriding controllers. What I found when doing this research was exactly what I needed. In order to override the the default paths provided by Devise, all that is needed, is to overload the path via a method in the ApplicationController.

  def after_sign_in_path_for(resource)
    dashboard_path
  end