restful urls and additional parameters

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

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

link_to ‘open orders’, orders_path(:status => ‘open’)

by the way, loving the restful approach.

zzz!

jeremy

# gives <a href="/orders?status=open">open orders</a> 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

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

Thanks,

Steve

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

Aaah. That's it. Thanks.