# Rails 3 routing for namespaced controllers

**URL:** <https://www.ruby-forum.com/t/rails-3-routing-for-namespaced-controllers/193756>\
**Category:** Rails\
**Created:** [August 23, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/rails-3-routing-for-namespaced-controllers/193756 "2010-08-23T23:16:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@ssk](https://www.ruby-forum.com/u/ssk)\
**Post date:** [August 23, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/rails-3-routing-for-namespaced-controllers/193756/1 "2010-08-23T23:16:59Z")

</div>

Hi,

I need to use legacy-style routing. And it’s namespaced.

According to [Rails Routing from the Outside In — Ruby on Rails Guides](http://edgeguides.rubyonrails.org/routing.html), it should  
be like the following.

match ‘:controller(/:action(/:id))’, :controller =\> /admin/[^/]+/

/admin/c1/a1 works fine.

But the problem is that, if I have /c2/a2 (note it’s not namespaced with  
admin) /admin/c2/a2 also works even if I don’t have Admin::C2Controller.  
So /admin/c2/a2 is mapped to c2#a2.

This might not be a big problem but I feel it’s weird.  
What do you think?

Sam
