README.md in multiverse-0.0.3 vs README.md in multiverse-0.1.0

- old
+ new

@@ -16,17 +16,19 @@ gem 'multiverse' ``` ## Getting Started -Generate a new database +In this example, we’ll have a separate database for our e-commerce catalog that we’ll call `catalog`. +The first step is to generate the necessary files. + ```sh rails generate multiverse:db catalog ``` -This generates `CatalogRecord` class for models to inherit from and adds configuration to `config/database.yml`. It also creates a `db/catalog` directory for migrations and `schema.rb` to live. +This creates a `CatalogRecord` class for models to inherit from and adds configuration to `config/database.yml`. It also creates a `db/catalog` directory for migrations and `schema.rb` to live. `rails` and `rake` commands run for the original database by default. To run commands for the new database, use the `DB` environment variable. For instance: Create the database @@ -90,9 +92,29 @@ And inside the `after_fork` block ```ruby CatalogRecord.establish_connection :"catalog_#{Rails.env}" ``` + +## Testing + +### Fixtures + +[Rails fixtures](http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures) work automatically. + +### Database Cleaner + +Database Cleaner supports multiple connections out of the box. + +```ruby +cleaner = DatabaseCleaner[:active_record, {model: CatalogRecord}] +cleaner.strategy = :transaction +cleaner.cleaning do + # code +end +``` + +[Read more here](https://github.com/DatabaseCleaner/database_cleaner#how-to-use-with-multiple-orms) ## History View the [changelog](https://github.com/ankane/multiverse/blob/master/CHANGELOG.md)