Is it possible to nest a resource more than a single level? For
example something like this:
map.resources :articles do |article|
article.resources :comments do |comment|
comment.resources :foo
end
end
--
Sterling Anderson
http://sterlinganderson.net/
sterling_anderson[at]mac.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
-~----------~----~----~----~------~----~------~--~---
Don''t see why not. Have you tried it and had problems? Jason On 4/2/07, sterling <sterling_anderson-ee4meeAH724@public.gmane.org> wrote:> > > Is it possible to nest a resource more than a single level? For > example something like this: > > map.resources :articles do |article| > article.resources :comments do |comment| > comment.resources :foo > end > end > > -- > Sterling Anderson > http://sterlinganderson.net/ > sterling_anderson[at]mac.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 -~----------~----~----~----~------~----~------~--~---
Yes you can, but you may want to take a look at this link[1] which suggests against doing so. [1] http://weblog.jamisbuck.org/2007/2/5/nesting-resources Nelson -- Basedex - A Collaborative Index to organize and collect everything related to Ruby on Rails http://blazingrails.basedex.com/index/8 sterling wrote:> Is it possible to nest a resource more than a single level? For > example something like this: > > map.resources :articles do |article| > article.resources :comments do |comment| > comment.resources :foo > end > end > > -- > Sterling Anderson > http://sterlinganderson.net/ > sterling_anderson[at]mac.com-- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---
The scenario explained in that article is pretty specific. There are
many instances where nesting further than a single level deep is
necessary. For example, if you were creating CRM system, you may have
a structure like:
map.resources :customers do |customers|
customers.resources :ships do |ships|
ships.resources :accounts
end
end
Here, each customer can have many shipping addresses and for each
shipping address there can be many ship accounts (ups, fedex, etc). In
addition, a shipping account is only associated with a single shipping
address and therefore should only be referenced through the shipping
address.
On Apr 2, 7:33 pm, Nelson Hsu
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Yes you can, but you may want to take a look at this link[1] which
> suggests against doing so.
>
> [1]http://weblog.jamisbuck.org/2007/2/5/nesting-resources
>
> Nelson
> --
>
> Basedex - A Collaborative Index to organize and collect everything
> related to Ruby on Railshttp://blazingrails.basedex.com/index/8
>
> sterling wrote:
> > Is it possible to nest a resource more than a single level? For
> > example something like this:
>
> > map.resources :articles do |article|
> > article.resources :comments do |comment|
> > comment.resources :foo
> > end
> > end
>
> > --
> > Sterling Anderson
> >http://sterlinganderson.net/
> > sterling_anderson[at]mac.com
>
> --
> Posted viahttp://www.ruby-forum.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
-~----------~----~----~----~------~----~------~--~---