Created
July 15, 2009 18:15
-
-
Save ncr/147870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It can be confusing, let me explain it: | |
When the removed feature was back and I wanted to invoke rake tasks that don't load :environment task (so no masochism) I was getting errors because those tasks treated my slave db as the only db. database.yml looked something like this: | |
production: | |
database: slave | |
master_database: | |
database: master | |
So I thought I will try to add slave_database and change the production db to master like this: | |
production: | |
database: master | |
slave_database: | |
database: slave | |
master_database: | |
database: master | |
I wanted this config so it's backward compatible with those tasks that don't know about masochism. | |
The problem was the removed feature: when slave_database: key is present then in effect the ActiveRecord::Base connection is not hijacked with proxy (ActiveReload::SlaveDatabase gets hijacked instead). Because of that the most default usage (where people want all AR::Base subclasses hijacked with conn proxy AND basic rake tasks functional) was impossible. | |
It's of course still possible to configure masochism in the previous way: | |
ActiveReload::ConnectionProxy.setup_for ActiveReload::MasterDatabase, ActiveReload::SlaveDatabase |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment