An open API service indexing awesome lists of open source software.

https://github.com/v2e4lisp/multi_connection

multiple database connections for activerecord
https://github.com/v2e4lisp/multi_connection

Last synced: about 1 month ago
JSON representation

multiple database connections for activerecord

Awesome Lists containing this project

README

          

# MultiConnection

Multiple database connections for rails

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'multi_connection'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install multi_connection

## Usage

### API

- `switch_to(:database)` database should be defined in you `database.yml` file.

### Example

```ruby
ActiveRecord::Base.switch_to(:production_slave) {
User.find(1)
}
```