# Passing paramters in Rest?

**URL:** <https://www.ruby-forum.com/t/passing-paramters-in-rest/141154>\
**Category:** Rails\
**Created:** [June 22, 2008, 11:04pm UTC](https://www.ruby-forum.com/t/passing-paramters-in-rest/141154 "2008-06-22T23:04:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 22, 2008, 11:04pm UTC](https://www.ruby-forum.com/t/passing-paramters-in-rest/141154/1 "2008-06-22T23:04:05Z")

</div>

In the old way, you can always pass params like this, right?

\<%= link\_to “Whatever”,:url =\> {:action =\> :new,param1 =\> :foobar} %\>

How would you do this Restfully?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 22, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/passing-paramters-in-rest/141154/2 "2008-06-22T23:41:33Z")

</div>

That’s actually the way I first thought of, but it didn’t work it  
seems. Scrolling down in the error page reveals all the parameters  
passed, and the ones passed through the restful routes don’t show up.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 23, 2008, 1:50am UTC](https://www.ruby-forum.com/t/passing-paramters-in-rest/141154/3 "2008-06-23T01:50:18Z")

</div>

Oh, I found out the reason it was reporting errors. I forgot that it  
was nested, so it needed 1 more parameter for the ID and then it  
accepted other params. Thanks!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 22, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/passing-paramters-in-rest/141154/4 "2008-06-22T23:31:36Z")

</div>

On Sun, Jun 22, 2008 at 2:03 PM, Mike C [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> In the old way, you can always pass params like this, right?
> 
> \<%= link\_to “Whatever”,:url =\> {:action =\> :new,param1 =\> :foobar} %\>
> 
> How would you do this Restfully?

Mike,

You can pass various parameters through the your restful routes.

\<%= link to( “create a new resource”, resource\_path( :id =\> resource,  
:extra\_param =\> foo, :extra\_param\_2 =\> bar ) ) %\>

Something along those lines should work fine.

Cheers,  
Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]
