Topic: Problem on Acts_as_authenticated....!~~~ please help

I try to install the Acts_as_authenticated plugin to my application.

I followed the simple instruction..
installed the plugin
script/generate ...

Then I can go to /users/signup/ successfully.
But after I filled in the form, I get an error message..
"ActiveRecord::StatementInvalid in AccountController#signup"
"Mysql::Error: Column 'remember_token_expires_at' cannot be null: INSERT INTO users (`salt`, `updated_at`, `crypted_password`, `remember_token_expires_at`, `remember_token`, `shipping_address`, `billing_address`, `login`, `created_at`, `email`) VALUES('627c5e3db997948fcf8b0b4579adf84d24190476', '2007-07-11 23:40:22', 'adeb4a0992e0bc1806413b0ea2bede5a60149d2a', NULL, '\"\"', NULL, NULL, 'samuel', '2007-07-11 23:40:22', '')"

It seems that the program cannot get the value of "remember_token_expires_at" , But i got totally no idea where i have went wrong or am i missing something...

I have added 2  extra column to the table, I dun know whether it leads to this problem..

please advice.

Re: Problem on Acts_as_authenticated....!~~~ please help

Hi there,

I've not used acts_as_authenticated before, but this error is due to you not allowing nulls in your MySQL table.  It is probably due to a line in a migration that is something like:

    t.column 'remember_token_expires_at', :datetime, :null => false

if you delete the
 , :null => false

section from this line and migrate again it should allow nulls in that column of the database and solve your problem. I don't see a reason why you shoud need to store a remember_expires_at if a user has never chosen to be remembered!

I prefer using the Technoweenie's restful_authentication plugin, have a look - … entication

Hope this helps


Re: Problem on Acts_as_authenticated....!~~~ please help

Thanks so much!
I am a total newbie to ruby on rails. I am not sure it is necessary to hv that column filled as null. But, i have tried to set it to be null, and it seems working fine, but I don't know what that field is for..

Further...I dun know anything about the "restful" the " restful_authentication" fine for me to use??

Re: Problem on Acts_as_authenticated....!~~~ please help

I would imagine that the remember_token_expires_at column in the database is for storing the date when a users session expires.  Like when a user checks the box on login that says "remember me for two weeks".  If a user has never clicked this box, it's never going to be required

It's fine for you to use the RESTful stuff, just so long as you're running on Rails 1.2 or edge.  You can watch DHH's keynote on REST and other interesting stuff from RailsConf 2006 at