Handle routes properly when the app is running in a subdirectory

This commit is contained in:
Matt Barringer 2013-01-20 13:06:01 +01:00
parent eb8c85c18f
commit 138106c2fb

View file

@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base
:authenticate_user! :authenticate_user!
if (current_user.nil?) if (current_user.nil?)
redirect_to '/accounts/sign_in' redirect_to new_user_session_path
return false return false
end end
@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base
end end
## Todo simplify this ## Todo simplify this
redirect_to '/' unless has_role?(current_user, 'admin') || has_role?(current_user, 'organizer') redirect_to root_path unless has_role?(current_user, 'admin') || has_role?(current_user, 'organizer')
end end
def verify_admin def verify_admin
@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base
return return
end end
redirect_to '/' unless has_role?(current_user, 'admin') redirect_to root_path unless has_role?(current_user, 'admin')
end end
def current_ability def current_ability
@ -41,6 +41,6 @@ class ApplicationController < ActionController::Base
rescue_from CanCan::AccessDenied do |exception| rescue_from CanCan::AccessDenied do |exception|
Rails.logger.debug("Access denied!") Rails.logger.debug("Access denied!")
redirect_to '/', :alert => exception.message redirect_to root_path, :alert => exception.message
end end
end end