Reputation: 85
Is it possible to use MongoMapper in application that stores its models in many databases? For example I have separated database for Users and another one for Orders and I want to model both User and Order using MongoMapper. Of course I can switch MongoMapper.connection attribute but it is potentially unsafe due to race condition.
Upvotes: 1
Views: 405
Reputation: 9094
You can set the connection per model:
User.connection(Mongo::Connection.new('localhost', 27017))
Upvotes: 1