I’m running Rails 3.2 and the latest version of Authlogic. When I run my app locally on my Mac, it works fine. When I try to run it on my production server (Ubuntu with Passenger/Apache), I get this:
You must establish a database connection before using acts_as_authentic
I’m not sure how to troubleshoot the problem. I posted this related question earlier today before I realized that the problem was broader than I thought.
I figured out the problem. Look at this snippet from Authlogic’s
lib/authlogic/acts_as_authentic/base.rb:If
column_namesthrows an error,db_setup?will return false. Look at this other function, also frombase.rb:If
db_setup?returns false, Authlogic will throw an exception, but not the same exception thrown bycolumn_names.My problem was that
column_nameswas throwing this exception:And the reason for THAT exception is that my user table is called
user, notusers, but Rails was not picking up on mypluralize_table_namessetting properly. Once I fixed mypluralize_table_namesproblem (apparently the way this setting works has been changed in Rails 3.1), my Authlogic problem went away.So if you’re having this problem, you might want to try this:
'authlogic', :path => '/path/to/authlogic')column_namescall todb_setup?outside thebegin/rescue/endclause