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
- Host: GitHub
- URL: https://github.com/v2e4lisp/multi_connection
- Owner: v2e4lisp
- License: mit
- Created: 2014-08-31T17:02:50.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-04T16:19:37.000Z (almost 12 years ago)
- Last Synced: 2025-01-16T03:51:35.916Z (over 1 year ago)
- Language: Ruby
- Size: 246 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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)
}
```