Strange error while using Authlogic

Hi to all,
i have installed authlogic as shown in this tutorial
DIXIS authlogic on rails3.
The fields i have used are t_login, t_password, t_name,
t_password_salt, t_persistence_token.

When i go to home#index, i get this error:

NameError in HomeController#index

uninitialized constant Authlogic

Application Trace | Framework Trace | Full Trace
app/models/user_session.rb:1
app/controllers/application_controller.rb:10:in current_user_session' app/controllers/application_controller.rb:16:in current_user’
app/controllers/application_controller.rb:21:in `require_user’

Do you know what this comes from???

Thank you in advance
Kostas L.

Anyone??? Any ideas??? I really cant find a sollution in the web…

Uninitialized constant usually means that the the module hasn’t been
loaded into the Rails environment. Adding an initializer file might fix
it, but it seems to me that this shouldn’t be necessary with Authlogic.
Make sure you’re using the most updated version of Authlogic.

config/initializers/authlogic.rb

require ’ authlogic’

Hi,
i have installed Authlogic using gem “authlogic” in the gemfile. I
also run bundle install and i did not got an error.

I have created an new application from scratch and now i get the
following error:
NoMethodError in User_sessions#new

Showing G:/…/AuthlogicTest/app/views/user_sessions/new.html.erb
where line #6 raised:

Model UserSession does not respond to t_login
Extracted source (around line #6):

3: <%= form_for @user_session, :url => {:action => “create”} do |f|%>
4: <%= f.error_messages%>
5: <%= f.label :t_login%>
6: <%= f.text_field :t_login%>
7: <%= f.label :t_password%>
8: <%= f.password_field :t_password%>
9: <%div%>

I havent found a sollution yet…

Any ideas??
Thank you again

On 26 November 2010 21:03, Kostas L. [email protected] wrote:

Model UserSession does not respond to t_login
Extracted source (around line #6):

3: <%= form_for @user_session, :url => {:action => “create”} do |f|%>
4: <%= f.error_messages%>
5: <%= f.label :t_login%>
6: <%= f.text_field :t_login%>

Is there a t_login column in the UserSession table?
Are you sure? Did you remember to run the migration to add it?
If the answer is yes then please post schema.rb and user_session.rb
If that is large then use pastie.org

Colin

Hi,
My project does not have an authlogic.rb file to write the require
“authlogic” line…
What i have done is i have installed authlogic in the gemfile using
gem ‘authlogic’, :git => ‘git://github.com/odorcicd/
authlogic.git’, :branch => ‘rails3’. Then i run the command bundle
install and i didn’t got any errors.

I have created from scratch a new application and now i get the
following errors:
NoMethodError in User_sessions#new

Showing G:/…/AuthlogicTest/app/views/user_sessions/new.html.erb
where line #6 raised:

Model UserSession does not respond to t_login
Extracted source (around line #6):

3: <%= form_for @user_session, :url => {:action => “create”} do |f|%>
4: <%= f.error_messages%>
5: <%= f.label :t_login%>
6: <%= f.text_field :t_login%>
7: <%= f.label :t_password%>
8: <%= f.password_field :t_password%>
9: <%div%>

When i comment out the text and password field i see the form but with
no fields.
I havent found a sollution yet. I googled the problem but nothing.
Any other idea??

Thanks again!

Hi colin,
i dont see any UserSession table…

On 26 November 2010 21:20, Kostas L. [email protected] wrote:

Hi colin,
i dont see any UserSession table…

That’s ok (I had forgotten how authlogic works).
Lets try again then :slight_smile:
Why have you got t_login and t_password in your view? Should it not
just be :login and :password?

Colin

Hi colin,
i have used these names because i have already created a php
application using these names and i want to create the same
application in rails.
Its for a project in my university.
I dont want to have different field names …
Do you think the problem is the names??? I dont think so…

Kostas

Hi colin,
as i have seen, authlogic does require default names like login,
password
etc. I was using t_login and t_password as i result getting these
errors.
I re-created my table with the new fields and everything works fine!!!

Home that helps someone else getting the same errors!!!

Thank you for your help!
Kostas

[email protected]

On Nov 29, 2010, at 11:58 PM, Konstantinos L. wrote:

Hi colin,
as i have seen, authlogic does require default names like login, password etc. I
was using t_login and t_password as i result getting these errors.
I re-created my table with the new fields and everything works fine!!!

You can also tell authlogic what fields to use if you don’t want to
rename it… either way…

-philip

On 27 November 2010 12:21, Kostas L. [email protected] wrote:

Please don’t top post, it makes it difficult to follow the thread.
Insert your reply into the previous post. Thanks

Hi colin,
i have used these names because i have already created a php
application using these names and i want to create the same
application in rails.
Its for a project in my university.
I dont want to have different field names …
Do you think the problem is the names??? I dont think so…

Well the error message is NoMethodError, Model UserSession does not
respond to t_login which is saying the UserSession does not have a
method t_login, which suggests to me that the name is the problem.
Have you done something somewhere else in your code to tell Authlogic
to expect the different names?

It is easy enough to see if this is the problem here, just change
those few lines of code and see if that error goes away.

Colin