README.md in apartment-0.21.1 vs README.md in apartment-0.22.0

- old
+ new

@@ -92,10 +92,22 @@ config.middleware.use 'Apartment::Elevators::Domain' end end ``` +**Switch on full host using a hash** +To switch based on full host with a hash to find corresponding database name use the following: + +```ruby +# application.rb +module My Application + class Application < Rails::Application + config.middleware.use 'Apartment::Elevators::HostHash', {'example.com' => 'example_database'} + end +end +``` + **Custom Elevator** A Generic Elevator exists that allows you to pass a `Proc` (or anything that responds to `call`) to the middleware. This Object will be passed in an `ActionDispatch::Request` object when called for you to do your magic. Apartment will use the return value of this proc to switch to the appropriate database. Use like so: ```ruby # application.rb @@ -279,17 +291,19 @@ ```ruby config.excluded_models = ["Delayed::Job"] ``` -## Development +## Contributing * In both `spec/dummy/config` and `spec/config`, you will see `database.yml.sample` files * Copy them into the same directory but with the name `database.yml` * Edit them to fit your own settings * Rake tasks (see the Rakefile) will help you setup your dbs necessary to run tests * Please issue pull requests to the `development` branch. All development happens here, master is used for releases * Ensure that your code is accompanied with tests. No code will be merged without tests + +* If you're looking to help, check out the TODO file for some upcoming changes I'd like to implement in Apartment. ## License Apartment is released under the [MIT License](http://www.opensource.org/licenses/MIT).