Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created April 11, 2010 19:46
Show Gist options
  • Select an option

  • Save tubbo/363009 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/363009 to your computer and use it in GitHub Desktop.
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController
#helper :all
#filter_parameter_logging :password
#protect_from_forgery
#helper_method :current_user_session, :current_user
private
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = Session.find
end
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment