# LoginEngine: undefined method \`logged\_in\_at='

**URL:** <https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234>\
**Category:** Engines\
**Created:** [January 25, 2006, 4:14pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234 "2006-01-25T16:14:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 4:14pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/1 "2006-01-25T16:14:10Z")

</div>

Hi, just installed the LoginEngine.

I keep getting this error when I log in:

undefined method `logged\_in\_at=’

That is on line 22 of the user\_controller:

def login  
return if generate\_blank  
@user = User.new(params[:user]) # what does this achieve?  
if session[:user] = User.authenticate(params[:user][:login],  
params[:user][:password])  
session[:user].logged\_in\_at = Time.now  
session[:user].save  
flash[:notice] = ‘Login successful’  
redirect\_to\_stored\_or\_default :action =\> ‘home’  
else  
@login = params[:user][:login]  
flash.now[:warning] = ‘Login unsuccessful’  
end  
end

It is logging me in. But tripping up because it can’t find a logged\_in  
method.

If I comment out that line, it works fine. Any ideas what is wrong? And  
whether commenting out this line will have consequences?

Thanks,

Steve

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 4:26pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/2 "2006-01-25T16:26:14Z")

</div>

The only function that line serves is to track when a particular user  
logged in, so commenting it out shouldn’t be a huge issue.

As to _why_ it’s causing you a problem… the line should simply  
assign the current time into the logged\_in\_at field of the user table.  
Did you use the migrations with the login engine to create your user  
table? Can you verify that the table has a logged\_in\_at field?

- james

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 5:51pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/3 "2006-01-25T17:51:22Z")

</div>

Thanks James.

I did not use migrations. I created my user table using the below from  
the  
bottom of the README file:

You need a database table corresponding to the User model. This is  
provided  
as a Rails Schema file, but the schema is presented below for  
information.

mysql syntax:  
CREATE TABLE users (  
id INTEGER UNSIGNED NOT NULL AUTO\_INCREMENT PRIMARY KEY,  
login VARCHAR(80) NOT NULL,  
salted\_password VARCHAR(40) NOT NULL,  
email VARCHAR(60) NOT NULL,  
firstname VARCHAR(40),  
lastname VARCHAR(40),  
salt CHAR(40) NOT NULL,  
verified INT default 0,  
role VARCHAR(40) default NULL,  
security\_token CHAR(40) default NULL,  
token\_expiry DATETIME default NULL,  
deleted INT default 0,  
delete\_after DATETIME default NULL  
) TYPE=InnoDB DEFAULT CHARSET=utf8;

This does not contain a logged\_in\_at field. I think that is my problem.

Steve

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 6:00pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/4 "2006-01-25T18:00:31Z")

</div>

Gah - that SQL is now woefully out of date - I need to remove it.  
Thanks, sorry for the confusion 🙂

- james

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 6:43pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/5 "2006-01-25T18:43:03Z")

</div>

No problem, thanks for your help.

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 26, 2006, 12:51am UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/6 "2006-01-26T00:51:45Z")

</div>

Patches are _very_ welcome, even to documentation.

(hint, hint)

- james

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 25, 2006, 8:35pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/7 "2006-01-25T20:35:18Z")

</div>

James,

How about updating the sql rather than removing it? It was very helpful  
to  
me to understand the engine.

-bakki kudva

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 26, 2006, 2:59pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/8 "2006-01-26T14:59:04Z")

</div>

Hi James,

I’d be happy to! I guess I’ll have to install the svn version to  
generate  
the diffs. When I first tried to install engines using svn it it didn’t  
work. (on Debian Sarge with subversion 1.1.4-2) Don’t recall what the  
error  
messages were. So I just installed using ‘script/plugin install’. Now  
the  
question is do I need to uninstall what I have before trying svn version  
or  
can I install over it? What is the procedure for an uninstall? Just  
delete  
vendor/engines dir along with the tables? If I am successful in  
Ajaxifying  
the login/user engines I can submit those patches as well… may take me  
a  
while to figure it all out 🙂

Thanks,

bakki

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [January 26, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/9 "2006-01-26T15:02:05Z")

</div>

Patches don’t need to be in diff format, but it does help. If you do  
create any, they should be submitted to the Trac site (linked from  
[rails-engines.org](http://rails-engines.org)).

To replace a plugin with another version, you can just move the  
existing folder out of the way (either into another folder outside of  
/vendor/plugins, or into /dev/null. i.e. oblivion) and replace it with  
the new version. SVN is currently the only way to get specific  
versions of the plugins that I’ve put up on [rails-engines.org](http://rails-engines.org), but  
there’s nothing special about the way that is set up. If you can’t  
get:

svn co  
[http://opensvn.csie.org/rails\_engines/login\_engine/branches/rb\_1.0](http://opensvn.csie.org/rails_engines/login_engine/branches/rb_1.0)  
login\_engine

to work, googling around with your particular error message should  
point you in the right direction.

Thanks!

- james

---

<div class="post-metadata">

**Author:** ![steveoco](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/db5fbb/32.png) [@steveoco](https://www.ruby-forum.com/u/steveoco)\
**Post date:** [April 8, 2006, 8:46pm UTC](https://www.ruby-forum.com/t/loginengine-undefined-method-logged-in-at/97234/10 "2006-04-08T20:46:15Z")

</div>

I agree with Bakki. I just got bit by the same incorrect sql code on the  
web page. We can do two things:

1. Fix the code, which would be nice
2. Indicate a little more clearly how to use the schema.rb file. I spent  
some time trying to figure it out, but I couldn’t. I want to learn it  
eventually, but it’s not my battle today. What’s not clear to me at this  
point is that it’s somehow tied to migrations, but I’m just trying to  
create a table, it seems like it should be one command.

Bakki K. wrote:

> James,
> 
> How about updating the sql rather than removing it? It was very helpful  
> to  
> me to understand the engine.
> 
> -bakki kudva
