steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-26 22:18 UTC
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/26/06, steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 <a href="/orders?status=open">open orders</a> link_to ''open orders'', orders_path(:status => ''open'') by the way, loving the restful approach. zzz! jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-27 01:48 UTC
Re: restful urls and additional parameters
> > # 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;store=hardware'' In the controller I can access the store param, but there is some extra junk params in there. Thanks, Steve --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/26/06, steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > > > # 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;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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
steve.odom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-27 10:07 UTC
Re: restful urls and additional parameters
Aaah. That''s it. Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---