Checked ActiveRecord, DataMapper, Follow up: some use globals (static variables) some require open db connection before loading source file with models. What ORM 's better to use within sinatra application that utilizes different databases.

DataMapper is made for multi-database use.

You are able to setup multiple databases simply by saying something similar to DataMapper.setup(:repository_one, "mysql://localhost/my_db_name").

DataMapper then tracks all of the databases which have been setup inside a hash that you could reference and employ for scoping:

DataMapper.repository(:repository_one){ MyModel.all }

(The default scope just being DataMapper.repository, which you'll setup by saying DataMapper.setup(:default, "postgres://localhost/my_primary_db") or even the like)

It appears that you'll be able to use different databases in many of ORMs. For DataMapper take a look at knowtheory answer. For Follow up you are able to pass database handler to model:

class Tag < Sequel::Model(db)
end

where db is opened up database. For ActiveRecord you should use establish_connection method.

Personally I favor Follow up for those my ORM and fundamental database accesses and it is things i use with Sinatra/Padrino and then any other time I have to access a database outdoors of Rails.

I have used DataMapper but felt Follow up was simpler and much more flexible, but maybe that's precisely how my thoughts works. ActiveRecord is alright by itself, but It is most effective in conjunction with Rails.

That is "better"? I believe that's subjective and mostly is associated with the way your brain works.