It really depends on the type of ORM. A great way to do this is to use inheritance. For example, you can have several databases and adapters defined in the database.yml file. You can easily talk to them using the ActiveRecord install_connection method.
class Account < ActiveRecord::Base
...
end
class NewConnection < ActiveRecord::Base
self.abstract_class = true
establish_connection "users_database"
end
class User < NewConnection
...
end
The only downside here is that when you connect to multiple active databases, migration can be a bit risky.
Mix ORM
Mixing ORMS is very simple. for example, mongodb (with mongoid) simply does not inherit from the active record and include the following in the model you want to use mongo:
class Vehicle
include Mongoid::Document
field :type
field :name
has_many :drivers
belongs_to :account
end
ORM, , . , mongoid ActiveRecord, , , .