about summary refs log tree commit diff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
authornicolas <nclm@users.noreply.github.com>2016-11-23 15:43:27 +0100
committerGitHub <noreply@github.com>2016-11-23 15:43:27 +0100
commit23677bc51e657522049fb904e626f81f577de515 (patch)
treedc9417c57a3af3036d621940a751e9adf1b09ce3 /app/controllers/application_controller.rb
parent1e95fbb10b81ea0eedcb39a83e52f42e3dbb456c (diff)
parent82191b33831f26e071a27dd59ce2e46fb467589c (diff)
Merge branch 'master' into french-translation
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 3a4c95db4..effb4ed78 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
 
   before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
   before_action :set_locale
+  before_action :check_rack_mini_profiler
 
   def raise_not_found
     raise ActionController::RoutingError, "No route matches #{params[:unmatched_route]}"
@@ -31,6 +32,10 @@ class ApplicationController < ActionController::Base
     I18n.locale = I18n.default_locale
   end
 
+  def check_rack_mini_profiler
+    Rack::MiniProfiler.authorize_request if current_user && current_user.admin?
+  end
+
   protected
 
   def not_found
@@ -46,6 +51,6 @@ class ApplicationController < ActionController::Base
   end
 
   def current_account
-    current_user.try(:account)
+    @current_account ||= current_user.try(:account)
   end
 end