https://github.com/rakeshpatra/custom_db_driver
A gem for cross db associations.
https://github.com/rakeshpatra/custom_db_driver
activerecord mongoid ruby ruby-on-rails
Last synced: 11 months ago
JSON representation
A gem for cross db associations.
- Host: GitHub
- URL: https://github.com/rakeshpatra/custom_db_driver
- Owner: rakeshpatra
- License: mit
- Created: 2016-05-27T12:29:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-07-16T07:42:10.000Z (almost 8 years ago)
- Last Synced: 2025-06-09T07:02:38.913Z (about 1 year ago)
- Topics: activerecord, mongoid, ruby, ruby-on-rails
- Language: Ruby
- Homepage:
- Size: 20.5 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# custom_db_driver
This gem solves a common problem when you try to write basic associations across multiple ORMs.
## Installation
In Bundler
```
gem 'custom_db_driver'
```
Otherwise
```
gem install custom_db_driver
```
## Configuration
just include the association module in your model in-order to use the association
For activerecord
```
class MySqlModel < ActiveRecord::Base
CustomDbDriver::CustomAssociation
to_mongo_db do
has_many :mongo_data, class_name: 'MongoModel', foreign_key: "foreign_key_id"
end
end
```
and For mongo
```
class MongoModel
include Mongoid::Document
include Mongoid::Timestamps
include CustomDbDriver::CustomAssociation
to_my_sql do
belongs_to :my_sql_model
has_one :other_my_sql_model
end
end
```
## Note
Currently it only supports with only activerecord(mysql) and mongoid, we will add support for others in near future.