Published 2023-02-01.
Last modified 2023-02-22.
Time to read: 2 minutes.
I want to build a web project using Ruby, Sinatra and a database. Ruby on Rails is not an appropriate web framework for my project, but Sinatra seems about right. Choosing a database layer, however, has proven to be problematic.
At first, I found code examples for Sinatra with DataMapper. I liked DataMapper a lot. Documentation was well done. The code examples worked, or could easily be made to work. Lots of examples can be found.
Then I learned that DataMapper had been abandoned 11 years ago in favor of Ruby Object Mapper (ROM). The last DataMapper version was v1.2.0, released on October 13, 2011.
Second System Effect
Supposedly, ROM was originally going to be DataMapper version 2, but actually ROM is a completely different user experience. This seems to be a classic example of the second system effect.
Worse, the syntax changes so much even in recent years, older ROM projects no longer work. I could not find information about upgrading projects for any version upgrade.
ROM has very few learning resources, for example, there are no books on ROM. None of the few example projects I could find worked any more – if they ever did work.

Then the coup de grĂ¢ce – StackOverflow queries to date:
- Active Record: 164,431
- rom-db: 73
ROM seems like a failed project. Too bad. Technically, it looks good. Unless significant resources were applied to overcome the issues I mention, however, I think that using ROM on a project would be an unnecessary liability.
Two Contenders
The two most popular contenders for a Sinatra ORM are ActiveRecord (best known with Ruby on Rails), and Sequel. I found the following comparison infographic on the Hanami Mastery website. I am not really interested in Hanami, since it competes with Sinatra.
Sinatra ActiveRecord
Seems that using ActiveRecord with Sinatra is a common occurance.
The GitHub project for
sinatra-activerecord
was originally written by
Blake Mizerany, the author of Sinatra.
The project ships with
two complete demonstration projects,
one for sqlite and one for postgres.
I wrote up my experience with sinatra-activerecord
separately.
Sequel for Sinatra
Sequel is another popular ORM for Ruby and Sinatra. I was impressed by the excellent documentation in the README. User-centrinc product exposition ... so rare in F/OSS!