Refactor RootController

This commit is contained in:
Robert Speicher 2015-06-12 20:53:58 -04:00
parent d2894a39e5
commit 8ae13c7a51
1 changed files with 12 additions and 2 deletions

View File

@ -7,12 +7,22 @@
# For users who haven't customized the setting, we simply delegate to # For users who haven't customized the setting, we simply delegate to
# `DashboardController#show`, which is the default. # `DashboardController#show`, which is the default.
class RootController < DashboardController class RootController < DashboardController
before_action :redirect_to_custom_dashboard, only: [:show]
def show def show
case current_user.try(:dashboard) super
end
private
def redirect_to_custom_dashboard
return unless current_user
case current_user.dashboard
when 'stars' when 'stars'
redirect_to starred_dashboard_projects_path redirect_to starred_dashboard_projects_path
else else
super return
end end
end end
end end