On Sep 12, 5:28 pm, mattwynne
<matt.wy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I know I can use a namespace on the map passed into the block for
> ActionController::Routing::Routes.draw because I''ve done that with
> some Admin:: controllers.
>
> What I want to do is something similar with controllers for resources
> that belong to another resource.
>
> Is it possible to do something like this:
>
> map.resources :shops do |shop|
>
> shop.resource :shopkeeper
>
> shop.namespace |goods| do
> goods.resources :sweets
> goods.resources :beer
> goods.resources :shoes
> end
>
> end
>
> so that I can have URLs like
>
> /shops/123/goods/sweets
> /shops/123/goods/beer
>
> and controllers like
>
> Goods::SweetsController
> Goods::ShoesController
>
> I had a go at this but it doesn''t seem to work - and I thought
I''d ask
> whether it was possible before I waste too much time on it.
That should work, just correct your namespace definition:
shop.namespace :goods do |goods|
goods.resources :sweets
goods.resources :beer
goods.resources :shoes
end
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---