README.md in database_slave-0.1.0 vs README.md in database_slave-0.1.1

- old
+ new

@@ -1,21 +1,38 @@ # Database_slave +[![Gem Version](https://badge.fury.io/rb/database_slave.svg)](https://github.com/Gnodiah/database_slave) +![](http://ruby-gem-downloads-badge.herokuapp.com/database_slave?type=total&color=red) + This gem provides master and slave databases support for Rails applications. It maintains a slave database configuration in config/shards.yml, and treats config/database.yml as master database. Then, you can choose which database you want to use in your ActiveRecord::Relation clauses. For example, you can use slave database to execute complicated and time-consuming database queries to balance the performance of master database, or separate read and write database operations. # Requirements * Ruby >= 2.0.0 * Rails >= 3.2.x +# Installation + +Put the following line into you Gemfile: + +```bash +gem 'database_slave', '>= 0.1.0' +``` + +then execute: + +```bash +bundle install +``` + # Preparing 1. First of all, create a file named **shards.yml** in your Rails config directory, its content is very similar to config/database.yml: - ``` + ```yml development: slave_database1: adapter: mysql2 encoding: utf8 reconnect: false @@ -38,10 +55,10 @@ ... ``` 2. Then add following to your settings.yml file: - ``` + ```ruby using_slave: true ``` **true** means you can use slave database, **false** means not.