# Restful urls and additional parameters

**URL:** <https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140>\
**Category:** Rails\
**Created:** [September 27, 2006, 12:24am UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140 "2006-09-27T00:24:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 27, 2006, 12:24am UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140/1 "2006-09-27T00:24:11Z")

</div>

I’m doing a restful refactoring of my site. Let’s say I have a link\_to  
an index action. My url would something like: orders\_url. What if I  
wanted to filter that index to show only open orders (or any other  
parameter). Can I pass an additional parameter with these new restful  
urls? If so, I can’t figure out how to construct my link\_to. Do I need  
to specify something in my route?

by the way, loving the restful approach.

steve

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 27, 2006, 12:34am UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140/2 "2006-09-27T00:34:13Z")

</div>

On 9/26/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m doing a restful refactoring of my site. Let’s say I have a link\_to  
> an index action. My url would something like: orders\_url. What if I  
> wanted to filter that index to show only open orders (or any other  
> parameter). Can I pass an additional parameter with these new restful  
> urls? If so, I can’t figure out how to construct my link\_to. Do I need  
> to specify something in my route?

# gives [open orders](https://www.ruby-forum.com/orders?status=open)

link\_to ‘open orders’, orders\_path(:status =\> ‘open’)

by the way, loving the restful approach.

zzz!

jeremy

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 27, 2006, 3:54am UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140/3 "2006-09-27T03:54:26Z")

</div>

> # gives [open orders](https://www.ruby-forum.com/orders?status=open)
> 
> link\_to ‘open orders’, orders\_path(:status =\> ‘open’)

Thanks Jeremy. That answered my question. Unfortunately in trying to  
make it simple and in doing some many iterations I got away from my  
real question.

My problem is I’m actually using a link\_to\_remote and I’m trying to  
pass two parameters. the problem is that rails is inserting an amp;amp;  
in the paramaters.

So something like:

> \<%= link\_to\_remote("hardware orders,  
> :url =\> orders\_url( :status=\>“open”, :store=\>“hardware”),  
> :method =\> ‘get’) %\>

It renders in the view like:  
\<a href=“#” onclick="new  
Ajax.Request(‘[http://localhost:3000/my/quiz/questions?status=open&amp;amp;store=hardware](http://localhost:3000/my/quiz/questions?status=open&amp;amp;store=hardware)’

In the controller I can access the store param, but there is some extra  
junk params in there.

Thanks,

Steve

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 27, 2006, 12:10pm UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140/4 "2006-09-27T12:10:31Z")

</div>

Aaah. That’s it. Thanks.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [September 27, 2006, 5:09am UTC](https://www.ruby-forum.com/t/restful-urls-and-additional-parameters/70140/5 "2006-09-27T05:09:59Z")

</div>

On 9/26/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My problem is I’m actually using a link\_to\_remote and I’m trying to  
> \<a href=“#” onclick="new  
> Ajax.Request(’  
> [http://localhost:3000/my/quiz/questions?status=open&amp;amp;store=hardware](http://localhost:3000/my/quiz/questions?status=open&amp;amp;store=hardware)  
> ’
> 
> In the controller I can access the store param, but there is some extra  
> junk params in there.

Yup - we’ve got a known double-escaping issue. Pass hash\_for\_orders\_url  
instead and you’ll be fine. I’m not sure how to resolve this.

jeremy
