restful_authentication: redirecting if already logged in


If someone is already logged in, I would like to redirect them to a
different page. I have that code in my app/controllers/
register_controller.rb file:

class RegisterController < ApplicationController
        def start
                if (logged_in?)
                        redirect_to :controller => "order", :action =>

but I'm getting an error if someone is not logged in. Visiting gives this error:

NoMethodError in RegisterController#start
undefined method `authenticate_with_http_basic' for
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace


register_controller.rb:40:in `start'

The method in question is located in lib/authenticated_system.rb, and
I've included that in my app/controllers/application.rb file:

class ApplicationController < ActionController::Base
  # Be sure to include AuthenticationSystem in Application Controller
  include AuthenticatedSystem

What does the error mean and how can I resolve it? Thanks, - Dave

looks like you are not using rails 2. You'll need to be on rails 2 to
use the current incarnation of restful_authentication, as it uses the
new built in http authentication classes.
Also, your whole controller structure doesn't look very RESTful! Start
now and be happy later.

Once you find a version of REStful_authentication that works with
Rails 1.2.x or update to Rails 2 see what the #create method does in
the (default) sessions controller to see how best to use the
logged_in? helper to check the login status, use RESTful or named
routes to do your redirect! (you'll thank me later)



According to my command prompt

[me@mymachine]~/% rails --version
Rails 2.0.2

I'm using Rails 2. What else could it be? And please throw in any
suggestions that would make my controller more RESTful.

Thanks, - Dave

Any chance you have multiple versions of rails and you're dealing with
an older project that you started in 1.x? If that's the case then I'd
check the rails version in environment.rb -- you may still be running
your app on 1.x even with 2.x installed. (BTW, I get the same
response with rails --version and i've got six versions of the
framework installed).