0.01
No commit activity in last 3 years
No release in over 3 years
Rails separate read and write.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Master Slave

By Tumayun.

Gem Version

Rails separate read and write.

Supported versions

  • Ruby >= 2.0.0
  • Rails >= 4.1.0

Install

Put this line in your Gemfile:

gem 'master_slave'

Then bundle:

% bundle

Usage

  1. Run command bundle exec rails g master_slave:config.

  2. Modify config/shards.yml.

Class User < ActiveRecord::Base
  ...
end

Random Slave

ActiveRecord::Base.slave do
  User.all
end

Specified Slave

ActiveRecord::Base.using(:slave_name) do
  User.all
end

Questions, Feedback

Feel free to message me on Github (tumayun) or Gmail (tumayun.2010@gmail.com).

Contributing to master_slave

  • Fork, fix, then send me a pull request.