Commit 0322244cf740371aa4ab4526f2801c4f73470b57
1 parent
4f728cd3
Exists in
master
and in
1 other branch
After login, if there is only one app, redirect to that app's path instead of th…
…e root path (apps#index).
Showing
1 changed file
with
8 additions
and
0 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -3,6 +3,13 @@ class ApplicationController < ActionController::Base |
3 | 3 | |
4 | 4 | before_filter :authenticate_user! |
5 | 5 | |
6 | + # Devise override - After login, if there is only one app, | |
7 | + # redirect to that app's path instead of the root path (apps#index). | |
8 | + def stored_location_for(resource) | |
9 | + location = super || root_path | |
10 | + (location == root_path && App.count == 1) ? app_path(App.first) : location | |
11 | + end | |
12 | + | |
6 | 13 | protected |
7 | 14 | |
8 | 15 | def require_admin! |
... | ... | @@ -10,3 +17,4 @@ class ApplicationController < ActionController::Base |
10 | 17 | end |
11 | 18 | |
12 | 19 | end |
20 | + | ... | ... |