Skip to content

Instantly share code, notes, and snippets.

@cyanglee
Created October 19, 2011 18:48
Show Gist options
  • Save cyanglee/1299266 to your computer and use it in GitHub Desktop.
Save cyanglee/1299266 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :find_user
#before_filter :set_locale
# redirect to the root page if the user doesn't have the permission to acccess that section of the site
rescue_from CanCan::AccessDenied do |exception|
# don't provide any information for users who access to the admin section
if exception.subject == :rails_admin
redirect_to "/"
else
redirect_to "/", :alert => exception.message
end
end
private
def find_user
@user = current_user
end
#def set_locale
# I18n.locale = "zh-TW"
#end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment