Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 440961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:55:29+00:00 2026-05-12T20:55:29+00:00

I just got done setting up my app to work with authlogic following this

  • 0

I just got done setting up my app to work with authlogic following this exactly

before beginning I had already created a products catalog with basic CRUD functionality.

Right now I want the products catalog to only be accesible if the user is alread logged in.. so, basically if the user is not logged in it should go to the login page.. if he is, then localhost:3000 should take him to the products catalog…. m really confused…I dont even know what to do to logout…

Instead, right now, being logged in and going to localhost:3000 redirects me to
http://localhost:3000/account

help please.

I have also noticed that if I go to my products catalog while being logged in I get this message on top f the page

“You must be logged out to access this
page”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:55:29+00:00Added an answer on May 12, 2026 at 8:55 pm

    Nacho, let me suggest you watch http://railscasts.com/episodes/160-authlogic

    It should answer all your questions, and more.

    Off the top of my head…

    Start with setting up your routes if you have not already:

      map.login 'login', :controller => 'user_sessions', :action => 'new'
    

    map.logout ‘logout’, :controller => ‘user_sessions’, :action => ‘destroy’

    Next, do this in your application controller:

      before_filter :authenticate, :except => [:login, :logout, :destroy, :index, :new]
    
      private #--------------------
    
      def authenticate
        unless current_user
          flash[:notice] = "You must be loged in first"
          redirect_to(login_url)
          return false
        end
      end
    
      def current_user_session
        return @current_user_session if defined?(@current_user_session)
        @current_user_session = UserSession.find
      end
    
      def current_user
        return @current_user if defined?(@current_user)
        @current_user = current_user_session && current_user_session.record
      end
    

    This should equip you to solve the issues mentioned above. If people are not logged in, they will be redirected to the login page. Also, to logout just point to logout_url (localhost:3000/logout)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just got done following the steps in this MSDN article on creating a
I just got this question on an interview and had no idea how to
I just got done walking through the install instructions on this page: http://grails.org/plugin/spring-security-facebook I
My app just got rejected by Apple with the following reason: 2.23 We found
I just got pagination to work on my site, but I wanted to use
I just got done reviewing the Notepad tutorial and looking at how they do
I just got my first app up and running on Node.js. As of now,
I've got a just installed ubuntu 11.10. I follow the first answer in this
I just got done working through the Django tutorials for the second time, and
Just got the new iPad, and when I touch the microphone and say a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.