DataMapper vs ActiveRecord in Rails 3

Ivo Sabev picture Ivo Sabev · Jan 10, 2011 · Viewed 9.1k times · Source

I am curious on what you guys think about DataMapper and what benefits does it bring over the new and improved ActiveRecord in Rails 3.

I appreciate your opinions.

Answer

piyush picture piyush · Jan 12, 2011

I prefer DM to AR. I feel DM is actually an ORM whereas AR is just a wrapper around SQL. DM makes is very easy to switch between data stores. Query syntax of DM is much more homogeneous etc. SEL (strategic eager load) also makes DM look more like an object store than AR.

Moreover, DM classes define properties up front and it makes the code much more readable. I have never missed migrations after coming to DM world. (even though you may have them if you really wish). With rails 3, I am almost exclusively using DM.