# Mapping parameter in a RESTful route

**URL:** <https://www.ruby-forum.com/t/mapping-parameter-in-a-restful-route/172667>\
**Category:** Rails\
**Created:** [July 25, 2009, 12:36am UTC](https://www.ruby-forum.com/t/mapping-parameter-in-a-restful-route/172667 "2009-07-25T00:36:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florent\_F.rent](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@Florent\_F.rent](https://www.ruby-forum.com/u/Florent_F.rent)\
**Post date:** [July 25, 2009, 12:36am UTC](https://www.ruby-forum.com/t/mapping-parameter-in-a-restful-route/172667/1 "2009-07-25T00:36:32Z")

</div>

Hello,

Is it possible to define a RESTful route like “map.resources :projects”  
having the id parameter mapped to params[:project\_id] instead of  
params[:id]?

I searched in  
[http://api.rubyonrails.org/classes/ActionController/Resources.html](http://api.rubyonrails.org/classes/ActionController/Resources.html) but  
could  
not find an option for this.

Regards,  
Florent

---

<div class="post-metadata">

**Author:** ![Florent\_F.rent](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@Florent\_F.rent](https://www.ruby-forum.com/u/Florent_F.rent)\
**Post date:** [July 28, 2009, 5:37pm UTC](https://www.ruby-forum.com/t/mapping-parameter-in-a-restful-route/172667/2 "2009-07-28T17:37:32Z")

</div>

Florent F.rent wrote:

> Is it possible to define a RESTful route like “map.resources :projects”  
> having the id parameter mapped to params[:project\_id] instead of  
> params[:id]?  
> If I understand your questions correctly this screencast from Ryan B.  
> might help:  
> [#63 Model Name in URL - RailsCasts](http://railscasts.com/episodes/63-model-name-in-url)

It may not be exactly what you’re looking for, but it might help you get  
there.

---

<div class="post-metadata">

**Author:** ![Florent\_F.rent](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@Florent\_F.rent](https://www.ruby-forum.com/u/Florent_F.rent)\
**Post date:** [July 29, 2009, 4:05am UTC](https://www.ruby-forum.com/t/mapping-parameter-in-a-restful-route/172667/3 "2009-07-29T04:05:27Z")

</div>

Thanks Robert for your answer, even if it was not what I was looking  
for.  
Anyway meanwhile I found an alternative solution to my problem, and had  
no  
more to have the id parameter mapped to params[:project\_id] instead of  
params[:id]?

Florent

2009/7/28 Robert W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
