README.md in multiverse-0.0.1 vs README.md in multiverse-0.0.2
- old
+ new
@@ -22,11 +22,11 @@
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.
-`rails` and `rake` commands will run for the original database by default. To run commands for the new database, use the `DB` environment variable. For instance:
+`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
```sh
DB=catalog rake db:create
@@ -63,37 +63,33 @@
```rb
class Product < CatalogRecord
end
```
-## Seeds
-
-Use `db/seeds.rb` for all databases
-
## Web Servers
+For web servers that fork, be sure to reconnect after forking (just like you do with `ActiveRecord::Base`)
+
### Puma
-Add to `config/puma.rb`
+In `config/puma.rb`, add inside the `on_worker_boot` block
```ruby
-on_worker_boot do
- CatalogRecord.establish_connection :"catalog_#{Rails.env}"
-end
+CatalogRecord.establish_connection :"catalog_#{Rails.env}"
```
### Unicorn
-Add to `config/unicorn.rb`
+In `config/unicorn.rb`, add inside the `before_fork` block
```ruby
-before_fork do |server, worker|
- CatalogRecord.connection.disconnect!
-end
+CatalogRecord.connection.disconnect!
+```
-after_fork do |server, worker|
- CatalogRecord.establish_connection :"catalog_#{Rails.env}"
-end
+And inside the `after_fork` block
+
+```ruby
+CatalogRecord.establish_connection :"catalog_#{Rails.env}"
```
## History
View the [changelog](https://github.com/ankane/multiverse/blob/master/CHANGELOG.md)