# Question about routing polymorphic associations, especially

**URL:** <https://www.ruby-forum.com/t/question-about-routing-polymorphic-associations-especially/111706>\
**Category:** Rails\
**Created:** [August 9, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/question-about-routing-polymorphic-associations-especially/111706 "2007-08-09T23:26:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arachnd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@arachnd](https://www.ruby-forum.com/u/arachnd)\
**Post date:** [August 9, 2007, 11:26pm UTC](https://www.ruby-forum.com/t/question-about-routing-polymorphic-associations-especially/111706/1 "2007-08-09T23:26:07Z")

</div>

I have a question regarding edge rails. The new routes syntax is:

map.resources :blog, :has\_many =\> :posts.

Now my question is how would I further specify the association? I  
want :posts to ‘has\_many :comments’.

But you can’t do:

map.resources :blog, :has\_many =\> :posts(:has\_many =\> :comments)

You can tell what I mean.

I don’t think it makes sense to do map.resources :posts, :has\_many  
=\> :comments because the whole point of nesting posts is so you can’t  
get it by itself. So how do I further nest it?

I tried something like this:

map.resources :shows do |shows|  
shows.resources :has\_many =\> :episodes do |episode|  
episode.resources :has\_many =\> :comments  
end  
end

and did rake routes but I didn’t see anything like /shows/:id/  
episodes/:id/comments/new

Help would be greatly appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![arachnd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@arachnd](https://www.ruby-forum.com/u/arachnd)\
**Post date:** [August 10, 2007, 5:03am UTC](https://www.ruby-forum.com/t/question-about-routing-polymorphic-associations-especially/111706/2 "2007-08-10T05:03:29Z")

</div>

Hi, afaik, if you want to use that syntax, rails edge endorses  
(enforces?) the notion that resources need not (should not) be nested  
more than one level deep in the url, because more is redundant. When  
you say /blog/12/posts/3/comments the blog\_id is know from the @post  
record. Thus, /posts/3/comments is sufficient, and all that is  
supported.
