Checked ActiveRecord, DataMapper, Sequel: some use globals (static variables) some require open db connection before loading source file with models. What ORM is better to use in sinatra application that uses different databases.
Checked ActiveRecord, DataMapper, Sequel: some use globals (static variables) some require open db connection
Share
DataMapper is designed for multi-database use.
You can set up multiple repositories just by saying something like
DataMapper.setup(:repository_one, "mysql://localhost/my_db_name").DataMapper then tracks all the repositories that have been setup in a hash that you can reference and use for scoping:
DataMapper.repository(:repository_one){ MyModel.all }(The default scope just being DataMapper.repository, which you can set up by saying
DataMapper.setup(:default, "postgres://localhost/my_primary_db")or the like)