Authlogic and rails 3 : NameError in User sessionsController#new

Hi everybody,

I've installed Authlogic on Rails 3 following the Railscast (http://
railscasts.com/episodes/160-authlogic), and the resources I was able
to find on the web, but I'm facing a problem.

Once I've generated the user_sessions controller and mapped the login
and logout routes, I get an error if I try to load the login page :
uninitialized constant UserSessionsController::UserSession
app/controllers/user_sessions_controller.rb:11:in `new'

The user_sessions model is really simple :
class UserSession < Authlogic::Session::Base
end

But it looks like this class declaration is not considered by Rails...

Does anyone have an idea ?

Thx by advance for your help.
Romain

Hi Romain,

Have a look at this link http://www.dixis.com/?p=352 on how to setup
authlogic with rails 3. I have had a similar problem, and after
following that tutorial, I managed to resolve my problem.

I do get a few deprecation warnings, but overall it has been working ok.

Hope that helps.

Regards,

Fidel.

Hi everybody,

I've installed Authlogic on Rails 3 following the Railscast (http://
railscasts.com/episodes/160-authlogic), and the resources I was able
to find on the web, but I'm facing a problem.

Once I've generated the user_sessions controller and mapped the login
and logout routes, I get an error if I try to load the login page :
uninitialized constant UserSessionsController::UserSession
app/controllers/user_sessions_controller.rb:11:in `new'

The user_sessions model is really simple :
class UserSession < Authlogic::Session::Base
end

But it looks like this class declaration is not considered by Rails...

Where is that file? is it in user_session.rb somewhere on the loadpath
(not user_sessions.rb)

Fred

Thx Fidel,

I'll have a look at this tutorial.

Romain

Yes it is, but in my setup it is user_sessions.rb with an "s". It
seems to me (but I'm a RoR newbie) that controller files should have
an "s"...
Can you tell me more on that ?
Thx
Romain

Romain B. wrote in post #961546:

Yes it is, but in my setup it is user_sessions.rb with an "s". It
seems to me (but I'm a RoR newbie) that controller files should have
an "s"...

They should. But this is a model, not a controller.

Can you tell me more on that ?
Thx
Romain

Best,