# Combine RESTful routes with DataMapper

**URL:** <https://www.ruby-forum.com/t/combine-restful-routes-with-datamapper/137779>\
**Category:** Rails\
**Created:** [May 16, 2008, 9:49am UTC](https://www.ruby-forum.com/t/combine-restful-routes-with-datamapper/137779 "2008-05-16T09:49:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![makire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@makire](https://www.ruby-forum.com/u/makire)\
**Post date:** [May 16, 2008, 9:49am UTC](https://www.ruby-forum.com/t/combine-restful-routes-with-datamapper/137779/1 "2008-05-16T09:49:47Z")

</div>

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.
