On Tue, Jun 28, 2011 at 4:18 AM, tfp44 <[email protected]> wrote:

> Hello all,
>
> Don't suppose anyone has a moment to give me a pointer on this one?
>
> I've tried the following:
>
> namespace "levelx" do
>   namespace "levely" do
>     namespace "levelz" do
>       root :to => 'levelz#index'
>     end
>     root :to => 'levely#index'
>   end
>   root :to => 'levelx#index''
> end
>
> This provides default routes for each namespace, but you then can't access
> any other controllers at each level of namespace. You can't specify a
> :controller segment, so adding match ":controller(/:action)" within each
> namespace block is not an option.
>
> I've also tried:
>
> match '/levelx/levely/levelz/:controller(/:action)'
> match '/levelx/levely/levelz' => 'levelx/levely/levelz#index'
> match '/levelx/levely/:controller(/:action)'
> match '/levelx/levely' => 'levelx/levely#index'
> match '/levelx/:controller(/:action)'
> match '/levelx' => 'levelx#index'
>
> Which again seems to route index actions OK but not other controllers
> within each namespace.
>
> I've tried:
>
> match '/levelx/levely/levelz/:controller(/:action)', :controller =>
> /levelx\/levely\/levelz*/
> match '/levelx/levely/:controller(/:action)', :controller =>
> /levelx\/levely*/
> match '/levelx/:controller(/:action)', :controller => /levelx\/levely*/
> match '/:controller(/:action)', :controller => /levelx*/
>
> Which doesn't seem to work.
>
> What I'm really after is the equivalent of the match
> '/:controller(/:action)' that will work with nested namespaces. If
> constraints can be applied to top level namespaces then so much the better.
>
> Maybe time to admit defeat and abandon rails for this type of website,
> which would be a shame since the rails framework is great for teh rest of
> the resource-based parts of the site. More likely I'm just being thick.
>
> Many thanks for any thoughts.
>
>
>

As a Rails best practice, I would recommend that you don't nest routes that
are more than two levels deep.

-Conrad

>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/1DW7luyPOWUJ.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to