Question

I'm starting a new project and I have maybe three resources defined. Not a lot of code so far. (Rails 3.1)

But I'm interested in trying out DataMapper. I'm used to ActiveRecord (and actually enjoy it) but I'm always on the lookout for new things. Plus, my application uses Backbone.js but I don't believe that's relevant.

So how hard is it to switch out the ORM "mid-app" like this and do you think the learning curve to DM is that hard?

PS, there is a chance that I might be using other engines alongside my application. Such as MongoDB running along with Postgres. Will DM be at an advantage there?

Was it helpful?

Solution

To use Datamapper itself, there isn't much to it but it is some of the Rails niceties that require additional work (like the SQL execution times in "rails s") and there is also the rake tasks.

Check out dm-rails - They have a template that you use to provision the initial Rails project that sets it up with everything for Datamapper. You can also look through the source and see how it hooks everything. There is a small issue if you use database-backed session stores with Datamapper, which involves a monkey patch.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top