I'm looking to use a more separated system for my models in a Ruby on Rails project. It looked like the solution was DataMapper. However, I see that none of their repositories have been updated in the last year, and when installed in a Rails 4 project, it has gem version dependency conflicts with newer Gems. Searching doesn't turn up any content on using it with Rails 4.
What is its state now? Should I use it, or something else?
As someone who uses DataMapper every day at my job, I would recommend sticking to ActiveRecord unless you are connecting to a legacy database that you don't control the schema of (but I would also consider Sequel if that were the case). Beyond the fact that it is EOL (as a maintainer stated on the mailing list), many gems that need model persistence will support ActiveRecord but it's very rare that they will support DataMapper, so expect to implement support yourself. In my experience if I find a bug I know I will also have to fix it myself due to the low usage / abandonment of DataMapper.
As danmanstx mentioned, the maintainers are mostly focused on Ruby Object Mapper (ROM) now, which used to be DM2. Although some pieces of ROM are feature-complete, it still doesn't have a release date AFAIK (see the roadmap).
If you look at the release-1.2
branch of the relevant DM gems, you can see that it does get minor updates every once in a while. However, there is a backlog of hundreds of issues across the DataMapper gems, many over 2 years old that simply won't be addressed because there just aren't enough DataMapper maintainers (and I don't blame them for wanting to work on something new!).
You're right about the latest RubyGems versions of DM gems having versioning conflicts. If you want to use the latest stable version of DM, I'd advise using the release-1.2
branch of the DM gems you need, e.g.
gem 'dm-core', git: 'git://github.com/datamapper/dm-core.git', branch: 'release-1.2'
You really should take a look at Sequel if you're considering DataMapper, FWIW I will be migrating away from ActiveRecord to Sequel.
However if you like the opinionated Rails ideology then you shouldn't look any further than ActiveRecord for least friction.
With no disrespect to the hard work of the Rails community and developers, but after dealing with the evolution of scopes, association conditions, relations vs associations, nested attributes, record initialisation, string based ordering clauses, search strings, hashes and arel,inability to express and compose queries easily or reuse scopes effectively, validation of related model bugs, parent vs child association building weirdness, poor documentation and none of it gelling together nicely, you may too decide to move to a clearly better thought out ORM like Sequel.
Similarly you may look at the ideology of Rails (being unabashedly opinionated), and consider what might fit better if you prefer choice and a conceptually cleaner approach in a modern web framework. Rails 4 was the last hoorah for me, hello Sinatra/Padrino/Sequel, Postgres/Redis/Solr and Backbone/Marionette/Eco/Coffeescript ... my opinionated web development framework :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With