Using Multiple Databases with authlogic - Authlogic Switches to using Alternative DB #25

ghost opened this Issue Aug 7, 2009 · 3 comments


None yet
4 participants

ghost commented Aug 7, 2009

I have a fairly generic setup of Authlogic using all defaults against a User table in my primary DB.

I have a 2nd separate database setup in my database.yml/models ala something like..

In database.yml ... a second_db entry

In an example model...
class ModelInOtherDB < ActiveRecord::Base
establish_connection :second_db

Whenever I use this MonelInOtherDB .. it works but when I reload the authlogic tries hitting the 2nd database not the primary DB with the User in it and faults with a ...

Could not find table ’user’ error

Ruby version 1.9.1 (i386-darwin9.6.0)
RubyGems version 1.3.3

original LH ticket

This ticket has 0 attachment(s).

i have an another problem :
i have a secondary DBwith my "user" table. It works on "developement mode" but when i put my app in production (config.cache_classes = true) : i have a
"NoMethodError (undefined method `valid_password?' for #User:0x7f6398c3ca28)"

seizmo commented Jul 7, 2011

I can confirm this still exists in bug in 2.1.6. In production mode authlogic does not respect the "establish_connection" or set_table_name 'otherdb.users' in production mode.

jaredbeck removed the @Ben Johnson label Jul 17, 2016


jaredbeck commented Dec 2, 2016

Closing after five years with no activity. If this is still a problem in the latest version (currently 3.5.0), please let us know.

jaredbeck closed this Dec 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment