Combine RESTful routes with DataMapper

Hi

I am writing an app in Rails 2 using DataMapper as ORM. It works fine
but an unexpected downside is that generated RESTful routes does not
work. In Rails 2 you can for example write:

edit_product_path(product)

and it will use the id attribute of product to generate the URL. This
no longer works because I assume that it relies on some ActiveRecord
feature that DataMapper does not suppy. It can be solved by writing:

edit_product_path(product.id)

which is simple enough but it also applies to redirect_to for which
the solution is a bit more elaborate. Besides having to change a lot
of code in the resource scaffolds I really like the compact way of
handling routes automatically, so my question is this:

What part of Rails is responsible for making the routes work and can
it be extended in DataMapper in some way?

Kindest regards

Erik L.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs