README.md in slavery-1.3.0 vs README.md in slavery-1.4.0
- old
+ new
@@ -4,11 +4,11 @@
Probably you just start off with one single database. As your app grows, you would move to master-slave replication for redundancy. At this point, all queries still go to the master and slaves are just backups. With that configuration, it's tempting to run some long-running queries on the slave. And that's exactly what Slavery does.
* Conservative - Safe by default. Installing Slavery won't change your app's current behavior.
* Future proof - No dirty hacks, simply works as a proxy for `ActiveRecord::Base.connection`.
-* Simple - Less than 100 LOC, you can read the entire source and completely stay in control.
+* Simple - Only 100+ LOC, you can read the entire source and completely stay in control.
Slavery works with ActiveRecord 3 or later.
## Install
@@ -125,6 +125,20 @@
ActiveRecord::Base.configurations = {
'development' => { adapter: 'mysql2', ... },
'development_slave' => { adapter: 'mysql2', ... }
}
ActiveRecord::Base.establish_connection(:development)
+```
+
+## Custom slave key in database.yml
+
+This is useful for deploying on EngineYard where the configuration key in database.yml is simple "slave". Put the following line in `config/initializers/slavery.rb`.
+
+```ruby
+Slavery.spec_key = "slave" #instead of production_slave
+```
+
+Alternatively you can pass it a lambda for dynamically setting this.
+
+```ruby
+Slavery.spec_key = lambda{ "#{Slavery.env}_slave" }
```