Skip to content

Instantly share code, notes, and snippets.

@vestige
Created April 9, 2012 14:08
Show Gist options
  • Save vestige/2343693 to your computer and use it in GitHub Desktop.
Save vestige/2343693 to your computer and use it in GitHub Desktop.
application_controller
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def signed_in?
current_user.present?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment