Are there any alternatives to the Sequel ORM when working on a Sinatra-based app?
-
"Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, [describe the problem](http://meta.stackoverflow.com/questions/254393) and what has been done so far to solve it." – the Tin Man Feb 09 '16 at 18:30
-
You ask for disadvantages in the title, but alternatives in the question. Which do you want? – the Tin Man Feb 09 '16 at 18:31
4 Answers
AFAIK, you are not forced to use Sequel with Sinatra. If you wish you can use Datamapper or an other ORM.

- 28,781
- 28
- 95
- 122

- 173,507
- 49
- 363
- 364
You don't have to use Sequel with Sinatra. Sinatra is pretty agnostic.
If you are interested in using ActiveRecord its pretty straightforward: require 'rubygems' require 'sinatra' require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => 'sinatra_application.sqlite3.db'
)
You can read more about ActiveRecord and Sinatra here. There is also a gem sinatra-activerecord that handles some of the boilerplate.
There is also the Ruby Object Mapper (rom-rb) which is a pretty nice implementation of the DataMapper pattern if you want something more fully featured than Sequel, but aren't interested in using ActiveRecord.

- 708
- 6
- 9
You might check out Padrino. It's a lightweight framework with a Sinatra core that supports several ORMs right out of the box.

- 158,662
- 42
- 215
- 303

- 3,030
- 1
- 23
- 25
-
Indeed, Padrino is very modular so you can just include the ORM parts without any of the other functionality. Padrino supports the following as ORM by default: mongoid, activerecord, datamapper, couchrest, mongomatic, ohm, ripple, sequel – Martijn Heemels Jul 09 '12 at 15:56
You can use DataMapper or ActiveRecord, or just plain DBI. Sinatra does not have any integrated support for a specific ORM framework.

- 158,662
- 42
- 215
- 303

- 6,533
- 5
- 58
- 64