KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-18 12:30 UTC
Trying to build a nested RESTful route in code?
I''ve never received a reply on this forum and don''t know if I''m doing this right, but here goes??? Everyone on this forum seems to be doing well with RESTful routes and I am enjoying them tremendously. I am attempting to use this approach in a very non-standard way. So here goes the foundation of my question. In a nested RESTful route we call it something like this; parent_child_path(parent) This is easy and it assumes that we are looking at ONE parent record to scope the children. Now, what happens if there are a group of parents built into the instance variable of the controller?; @parentscope = Parent.find([1, 2, 3]) We call the nested RESTful route like this; parent_child_path(@parentscope) Where I''m stumped is that I''m faced with the challlenge of building this multi-scoped nested RESTful route in code and delivering it to a ''link_to'' statement. I know you must be thinking, "how did she paint herself into such a corner". Currently, (thanks to Alex) I''m able to deliver this value as a field in a ''link_to'' like this; <%= link_to ''Place to go'', eval(table.row.routepath) %> My guess is that I must build a method in the parent model.rb to assemble this value, but I can find no examples of how this might be done. I''m a little desperate here, and will pay money or work for slave wages in exchange for help. Thank you, Kathy KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Everyone on this forum seems to be doing well with RESTful routes and I am enjoying them tremendously. I am attempting to use this approach in a very non-standard way. So here goes the foundation of my question. In a nested RESTful route we call it something like this; parent_child_path(parent) This is easy and it assumes that we are looking at ONE parent record to scope the children. Now, what happens if there are a group of parents built into the instance variable of the controller?; @parentscope = Parent.find([1, 2, 3]) We call the nested RESTful route like this; parent_child_path(@parentscope) Where I''m stumped is that I''m faced with the challlenge of building this multi-scoped nested RESTful route in code and delivering it to a ''link_to'' statement. I know you must be thinking, "how did she paint herself into such a corner". Currently, (thanks to Alex) I''m able to deliver this value as a field in a ''link_to'' like this; <%= link_to ''Place to go'', eval(table.row.routepath) %> My guess is that I must build a method in the parent model.rb to assemble this value, but I can find no examples of how this might be done. I''m a little desperate here, and will pay money or work for slave wages in exchange for help. Thank you, Kathy KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---