be sure to add " if session[:user_id] " to the end of the line so your code doesn't crash when there isn't a session[:user_id]