From 8d9f63ae392a8672f565fd0742d7b29788e19b2d Mon Sep 17 00:00:00 2001 From: George Vinogradov Date: Fri, 28 Oct 2011 21:55:10 +0400 Subject: [PATCH] Renamed check_global_rights to check_global_access. --- lib/ext/application_controller/base.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ext/application_controller/base.rb b/lib/ext/application_controller/base.rb index f0df2edaa..7f6f34fbf 100644 --- a/lib/ext/application_controller/base.rb +++ b/lib/ext/application_controller/base.rb @@ -7,10 +7,14 @@ class ActionController::Base current_user.can_perform? c, a, target end - def check_global_rights + def check_global_access unless can_perform? flash[:notice] = t('layout.not_access') - redirect_to(:back) + if request.env['HTTP_REFERER'] + redirect_to(:back) + else + redirect_to(:root) + end end end