Skip to content

Instantly share code, notes, and snippets.

@george
Created August 13, 2008 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save george/5237 to your computer and use it in GitHub Desktop.
Save george/5237 to your computer and use it in GitHub Desktop.
class HomePageController < ApplicationController
# this ensures 'current_user' is populated with the logged in user
before_filter :login_required
def index
# populate an ivar (instance variable) so we can use it in the view
@user = current_user
@lists = @user.lists
@other_things_the_user_owns = @user.other_things_the_user_owns
end
end
# routes.rb
map.root :controller => 'home_page' # :action => 'index' is superfluous as it is the default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment