From 0322244cf740371aa4ab4526f2801c4f73470b57 Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Thu, 1 Sep 2011 16:27:16 +0800 Subject: [PATCH] After login, if there is only one app, redirect to that app's path instead of the root path (apps#index). --- app/controllers/application_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5981bdf..b77eabf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,6 +3,13 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! + # Devise override - After login, if there is only one app, + # redirect to that app's path instead of the root path (apps#index). + def stored_location_for(resource) + location = super || root_path + (location == root_path && App.count == 1) ? app_path(App.first) : location + end + protected def require_admin! @@ -10,3 +17,4 @@ class ApplicationController < ActionController::Base end end + -- libgit2 0.21.2