From 94d3c1433df9380ca83f1f35a540074ff0690410 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 10 Jun 2015 03:59:39 -0400 Subject: Add RootController This controller is now the target for `root_url`. It sub-classes DashboardController so we can render the old default without a redirect if the user hasn't customized their dashboard location. --- app/controllers/root_controller.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 app/controllers/root_controller.rb (limited to 'app/controllers/root_controller.rb') diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb new file mode 100644 index 00000000000..7606d2d0fbe --- /dev/null +++ b/app/controllers/root_controller.rb @@ -0,0 +1,18 @@ +# RootController +# +# This controller exists solely to handle requests to `root_url`. When a user is +# logged in and has customized their `dashboard` setting, they will be +# redirected to their preferred location. +# +# For users who haven't customized the setting, we simply delegate to +# `DashboardController#show`, which is the default. +class RootController < DashboardController + def show + case current_user.try(:dashboard) + when 'stars' + redirect_to starred_dashboard_projects_path + else + super + end + end +end -- cgit v1.2.3