Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjustments needed in a Rails app to use Datamapper instead of ActiveRecord

I am trying to use Datamapper in a Rails app as an alternative to ActiveRecord.

I've followed the various setup instructions and have Datamapper working in my app.

But one of the first things I noticed that no longer works is this:

  <%= f.error_messages %>

I believe this is tied to an ActiveRecord helper - is there an alternative way of reporting validation failures in the View for Datamapper?

Am I likely to encounter many more examples of functionality like this that will require adjustments in my app?

Is this project doable or is it likely to involve a lot of complicated hackery?

Has anyone documented all of the required application adjustments?

I suspect Datamapper is not used widely because I'm finding it hard to find these kinds of simple instructions on Google.

like image 618
Baker Avatar asked Oct 26 '22 04:10

Baker


1 Answers

Today Rails plays well with ActiveRecord; changing ORM will surely give you some troubles. Rails 3.0 will be ORM agnostic so I expect a switch like the one you are describing to be easier in the future.

Unless you are craving to understand Rails inside-out and you are going to have the time to fix the glitches that your application will expose, stick with ActiveRecord.

Am I likely to encounter many more examples of functionality like this that will require adjustments in my app?

It depends on the code you have already wrote. For what you have reported in your question I'd say yes.

Is this project doable or is it likely to involve a lot of complicated hackery?

It is doable and will involve a lot of complicated hackery. The downside is that most of what you are going to learn from this hackery will be likely outdated by Rails 3.0.

like image 68
lbz Avatar answered Oct 30 '22 03:10

lbz