Created
December 20, 2010 00:47
-
-
Save mthomas/747882 to your computer and use it in GitHub Desktop.
application_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
helper :all # include all helpers, all the time | |
protect_from_forgery # See ActionController::RequestForgeryProtection for details | |
private | |
def require_user | |
unless current_user | |
flash[:notice] = "You must be logged in to access that page" | |
redirect_to new_session_url | |
return false | |
end | |
end | |
def require_no_user | |
if current_user | |
flash[:notice] = "You must be logged out to access that page" | |
redirect_to current_user | |
return false | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment