# RESTful routes: How to pass an additional value to params?!

**URL:** <https://www.ruby-forum.com/t/restful-routes-how-to-pass-an-additional-value-to-params/135456>\
**Category:** Rails\
**Created:** [April 22, 2008, 11:43am UTC](https://www.ruby-forum.com/t/restful-routes-how-to-pass-an-additional-value-to-params/135456 "2008-04-22T11:43:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [April 22, 2008, 11:43am UTC](https://www.ruby-forum.com/t/restful-routes-how-to-pass-an-additional-value-to-params/135456/1 "2008-04-22T11:43:44Z")

</div>

Hi there,

is it true that with RESTful routes, I can’t pass an additional value to  
the params hash anymore, within a link?

# Example:

## Old school:

\<%= link\_to ‘New message’, :controller =\> ‘messages’, :action =\> ‘new’,  
:target\_id =\> @member.id %\>

## RESTful new school:

\<%= link\_to ‘New message’, new\_user\_message\_path(@user), :target\_id =\>  
@member.id %\>

-\> But doing it like this just ignores the “:taget\_id” that I need to  
pass to the controller !

How should I do this using RESTful routes?

Thanks a lot for your help!  
Tom

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [April 22, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/restful-routes-how-to-pass-an-additional-value-to-params/135456/2 "2008-04-22T12:41:32Z")

</div>

this will do

\<%= link\_to ‘New message’, new\_user\_message\_path(@user, :target\_id =\>  
@member.id) %\>

just pass the value within the pathhelper

---

<div class="post-metadata">

**Author:** ![tharrisx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e19adc/32.png) [@tharrisx](https://www.ruby-forum.com/u/tharrisx)\
**Post date:** [April 22, 2008, 12:53pm UTC](https://www.ruby-forum.com/t/restful-routes-how-to-pass-an-additional-value-to-params/135456/3 "2008-04-22T12:53:53Z")

</div>

Great! Thanks a lot, Thorsten!
