Authlogic Page View Authentication Help


I am a newbie at ROR, and I am grasping my head around Authlogic. I am
having hard time trying to figure out how can I do the following:

in my application controller I have the following helpers:

filter_parameter_logging :password, :password confirmattion

helper_method :all

  def current_user_session
    return @current_user_session if defined?

@current_user_session = UserSession.find

  def current_user
    return @current_user if defined?(@current_user)
    @current_user = current_user_session &&


  def require_user

unless current_user
flash[:notice] = “You must be logged in to access this page”
redirect_to new_user_session_url
return false


Now I want only users to be logged in to upload photos. So if the hit
the upload link it takes them to a page, and the page tells them they
have to logged in to upload. Once they register or login it takes them
to another view that has the link for them to upload their picture.

Can someone tell me how I do this. I really appreciate your help.

Thanks in advance

figured it out.