This gem solves a common problem when you try to write basic associations across multiple ORMs.
In Bundler
gem 'custom_db_driver'
Otherwise
gem install custom_db_driver
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
Currently it only supports with only activerecord(mysql) and mongoid, we will add support for others in near future.