Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error of undefined method 'valid_password?' with Authlogic

I get suddenly the below error on my server with Authlogic

NoMethodError (undefined method `valid_password?' for #<ProductionHouse:0xb53859cc>):

authlogic (2.1.3) [v] lib/authlogic/session/password.rb:191:in `send'

authlogic (2.1.3) [v] lib/authlogic/session/password.rb:191:in `validate_by_password'

authlogic (2.1.3) [v] lib/authlogic/session/callbacks.rb:72:in `validate'

authlogic (2.1.3) [v] lib/authlogic/session/validation.rb:64:in `valid?'

authlogic (2.1.3) [v] lib/authlogic/session/existence.rb:65:in `save'

app/controllers/user_session_controller.rb:162:in `create'

pdfkit (0.5.1) lib/pdfkit/middleware.rb:16:in `call'

Cant get the issue sudden happen? Is there any one knows regarding this then please help?

like image 382
chirag.sweng Avatar asked Sep 14 '11 06:09

chirag.sweng


1 Answers

I get this error if I start the web server (in my case Thin) before the database is available (in my case MySQL is not running for example).

I load up the app in my browser and it complains that MySQL is not running, so I start MySQL, return to the app which now loads correctly, but will not let me log in (I get the error described by the OP).

If I now go and restart the web server, and try again, I can log in without error.

Presumably valid_password? is a method that is added to the model at boot time, and is dependent on the database being available.

like image 118
Mike Pollitt Avatar answered Sep 25 '22 18:09

Mike Pollitt