I would like to use the multi_db gem to connect to multiple slave
databases. It looks pretty easy as long as your app has a single
application database. For example:
production:
adapter: mysql
database: a_production
username: blahblah
password:
host: 10.0.0.1
port: 3306
production_slave_database_1:
adapter: mysql
database: a_production
username: blahblah
password:
host: 10.0.0.3
port: 3306
production_slave_database_2:
adapter: mysql
database: a_production
username: blahblah
password:
host: 10.0.0.4
port: 3306
The issue I am having is I can't figure out how to configure it to
work with multiple application databases. Let's say your app has 2
databases, your main app database and data database. The app database
has users info and user created info while the data database has a lot
of read only data that gets updated say...once a week.
You might create a
production:
adapter: mysql
.
.
.
production_data:
adapter: mysql
.
.
.
Then you might want slave/s for each of those databases. You can use
establish_connection in the models that need to access the
production_data database. There is a way to do it with masochism like
this:
##example, showing the setup of a different master/slave combo using
setup_for
config.after_initialize do
ActiveReload::ConnectionProxy.setup!
ActiveReload::ConnectionProxy.setup_for SpeciesSchemaWriter,
SpeciesSchemaModel
end
But, as far as I know you can only use a single slave with masochism,
is that true?
Thanks for any help.
Erik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---