diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b77eabf..afed241 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,20 +1,28 @@ class ApplicationController < ActionController::Base protect_from_forgery - + 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! - redirect_to root_path unless user_signed_in? && current_user.admin? - end - + + rescue_from ActionController::RedirectBackError, :with => :redirect_to_root + + +protected + + + def require_admin! + redirect_to_root unless user_signed_in? && current_user.admin? + end + + def redirect_to_root + redirect_to(root_path) + end + + end - -- libgit2 0.21.2