This project is archived and is in readonly mode.
ActiveRecord.establish_connection uses class variable instead of accessor method
-
Pratik
- Assigned user set to Pratik
- State changed from new to invalid
You should just call establish_connection() from the model instead of overriding connection_handler.
class Model < ActiveRecord::Base establish_connection ... end -
ronin-37489 (at lighthouseapp)
I would normally do just that. However, for this case, I need to connect to many databases with the same schema. Therefore, if the connection handler has a cache of connections based on the model name, then this would work. Ideally, the connection handler should cache on the hostname + database name + table. Or, in my case, overriding the connection handler with it's own cache.
-
ronin-37489 (at lighthouseapp)
correction: ...then this would not work..