There is another way of doing :has_many that is this way:
map.resources :posts do |post|
post.resources :comments
end
This way your route will be something like this:
map.namespace :blog do |blog|
map.resources :channels do |channel|
channel.resources :articles do |article|
article.resources :comments
end
end
end
On May 8, 2008, at 6:10 PM, rails.impaired wrote:
>
> I''m wondering how or if it is possible to nest a resource more
than
> one level.
>
> routes.rb
>
> map.namespace :blog do |blog|
> blog.resources :channels, :has_many => :articles
> end
>
> For example, how could I say that would like each article to have
> nested comments.
>
> map.namespace :blog do |blog|
> blog.resources :channels, :has_many
> => :articles ?? :has_many :comments
> end
>
> I''m thinking the url would look something like:
> /blog/channel/1/article/1/comment/1
>
> Thanks,
>
> resident moron
>
--
Rafael Gaspar - rafael.gaspar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
http://rafaelcanhasblog.com
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---