Using Masochism multiple DB support with Engine Yard Cloud
If you’re using the Engine Yard Cloud, and you want to run in a single master, single slave MySQL setup you can accomplish this pretty easily using Masochism. It’s as easy as:
script/plugin install git://github.com/technoweenie/masochism.git
- Create deploy/before_migrate.rb if you don’t have it already, then add this line to it:
run "sed -ibak -e 's/^production:$/master_database:/; s/^slave:$/production:/' #{shared_path}/config/database.yml"
- Add to environment.rb (within the Rails::Initializer.run block):
config.after_initialize do if Rails.env.production? ActiveReload::ConnectionProxy::setup! end end