The idea of DataMapper is definitely better than ActiveRecord. It has one API for various data warehouses, including RDBMS and NoSQL stores. DataMapper is much smarter than ActiveRecord. It has a "strategic load." This function alone destroys the "N + 1 Query Problem". In addition, it allows lazy loading of heavy fields, such as the Text property. DataMapper allows you to create and search for any graph of complex objects, simply by providing a nested hash of conditions. ActiveRecods is not suitable for integration into production. The enable method is ugly and unconfigurable. In October 2010, Josh Symonds makes a patch for this method so that the fields are excluded from the loaded. But this path was ignored, and today in rails3 we have the same ugly method.
Even in Rails3 with brilliant AREL, ActiveRecord is far from the best orm for rails. You can say "wow, this new gem allows you to write good code, for example Article.where(:title.matches => 'Hello%', :created_at.gt => 3.days.ago)." But wait ... DataMapper supports this out of the box! Maybe instead of modifying ActiveRecord, it seems like DataMapper is better to extend and support better than orm? More information about DataMapper can be found at http://datamapper.org/ .
I think that rails in later versions should allow us to choose which one to use, for example, now it allows us to select a database. Even he will have only one option "ActiveRecord", people will look for available alternatives. When I started learning rails, I thought there was support only for ActiveRecord. And later I didn’t even try to look for something else.
Why am I writing all this? I think we need to pay more attention to this pretty ORM. If you are a developer of some popular or not so popular gem, consider adding DataMapper support. The DataMapper community should write some migration guides from ActiveRecord or another ORM and save the uptodate documentation, and yours can help them. For me, the DataMapper community needs more people, and you can be one of them. The only drawback of this ORM is the lack of documentation, and you can help.
So what do you think of this?
source
share