# Trying to build a nested RESTful route in code?

**URL:** <https://www.ruby-forum.com/t/trying-to-build-a-nested-restful-route-in-code/109737>\
**Category:** Rails\
**Created:** [July 18, 2007, 2:32pm UTC](https://www.ruby-forum.com/t/trying-to-build-a-nested-restful-route-in-code/109737 "2007-07-18T14:32:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kathleen\_Kennedy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/9de053/32.png) [@Kathleen\_Kennedy](https://www.ruby-forum.com/u/Kathleen_Kennedy)\
**Post date:** [July 18, 2007, 2:32pm UTC](https://www.ruby-forum.com/t/trying-to-build-a-nested-restful-route-in-code/109737/1 "2007-07-18T14:32:48Z")

</div>

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  
removed\_email\_address@domain.invalid
