How to define routes for resource that belongs to multiple resources?

Say I have resource comment that belongs to resources post and blog. I
know that to nest comment into say, post would look like this:

map.resources :posts do |post|
post.resources :comments
end

However, if I wanted :comments to also belong to :blogs, how would I
do that?

On Jun 22, 5:47 pm, Mike C [email protected] wrote:

Say I have resource comment that belongs to resources post and blog. I
know that to nest comment into say, post would look like this:

What you’re really looking for is called Polymorphic Associations:
http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations

Thanks a bunch! :slight_smile:

Actually I just read through that and while it’s useful, I still want
to know the syntax for defining such relationships.