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

- old
+ new

@@ -2,10 +2,12 @@ Scale database reads to replicas in Rails :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource) +[![Build Status](https://travis-ci.org/ankane/distribute_reads.svg?branch=master)](https://travis-ci.org/ankane/distribute_reads) + ## Installation Add this line to your application’s Gemfile: ```ruby @@ -16,17 +18,17 @@ [Makara](https://github.com/taskrabbit/makara) does most of the work. First, update `database.yml` to use it: ```yml default: &default - adapter: postgresql_makara + url: postgresql-makara:/// makara: sticky: true connections: - role: master name: primary - url: <%= ENV["PRIMARY_DATABASE_URL"] %> + url: <%= ENV["DATABASE_URL"] %> - name: replica url: <%= ENV["REPLICA_DATABASE_URL"] %> development: <<: *default @@ -48,9 +50,23 @@ ```ruby distribute_reads do User.find_each do |user| # replica user.orders_count = user.orders.count # replica user.save! # primary + end +end +``` + +## Jobs + +Distribute all reads in a job with: + +```ruby +class TestJob < ApplicationJob + distribute_reads + + def perform + # ... end end ``` ## Options