aneta_bielska [:blog]

ORMs Alternative to ActiveRecord
#data-mapper #ROM #sequel #ORM

Ruby on Rails, ActiveRecord an ultimate truth. Now I am using Sinatra with DataMapper. I feel a bit like I am escaping Matrix. Don’t get me wrong. I really like Active Record. AR is a powerful tool and speeds things up. My intention is to dig around and show some alternatives. For instance DataMapper.


DataMapper is a lightweight and fun tool to work with. It is an ORM written in Ruby. The goal was to create an ORM which is fast, thread-safe and feature rich. It works well with Sinatra. Check this article to see example solution from my project.

My impressions are that it is a good solution for small applications. If you checked DM github repository you probably noticed it is abandoned. So that’s one of the reasons why to use it cautiously. Ideas behind DM are now being transformed into ROM.

Ruby Object Mapper (ROM)

First contact with ROM I had on wroc_love.rb 2016. I am really happy I could hear Oskar Szrajer’s talk: 1 year with ROM on production which was very nice introduction to ROM. Although it is considered to be a complex tool and is not fully documented (yet) I added ‘ROM further exploration’ to my TODO list.

From Ruby Object Mapper is a Ruby persistence library with the goal to provide powerful object mapping capabilities without limiting the full power of your datastore. Note: ROM creators don’t call it an ORM, but it is listed as one in ruby toolbox ORM list. First stable version was relised in January 2016. It is gaining popularity so you can expect more and more support from the community.


Shortly from sequel github: Sequel is a simple, flexible, and powerful SQL database access toolkit for Ruby.

Pattern used in sequel is similar to Active Record. I may even consider it to use it with my api. Just for sake of trying something new. It seems to be stable and well maintained. Interesting thing about it is that you can do almost anything without writing any SQL (ie. #left_join).

Summing up. Of course there are more alternatives. I listed top 3 that caught my attention. Which ORM you would recommend? Please share your thoughts in comments below.

You may also enjoy:

#servers (1) #hosting (1) #sinatra (2) #assets (1) #sprockets (1) #react-js (1) #data-mapper (1) #ROM (1) #sequel (1) #ORM (1) #pg (1) #sqlite3 (1) #postgresql (1) #ruby (4) #ubuntu (1) #heroku (1) #git (1) #css (3) #cors (1) #same-origin-policy (1) #rake (1) #web-scraping (1) #ruby-on-rails (1) #brug (1) #elixir (1) #benchmark (1)