# How to map a Named Route onto a namespaced resource?

**URL:** <https://www.ruby-forum.com/t/how-to-map-a-named-route-onto-a-namespaced-resource/181962>\
**Category:** Rails\
**Created:** [January 20, 2010, 9:30pm UTC](https://www.ruby-forum.com/t/how-to-map-a-named-route-onto-a-namespaced-resource/181962 "2010-01-20T21:30:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tuktuk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/77aa72/32.png) [@tuktuk](https://www.ruby-forum.com/u/tuktuk)\
**Post date:** [January 20, 2010, 9:30pm UTC](https://www.ruby-forum.com/t/how-to-map-a-named-route-onto-a-namespaced-resource/181962/1 "2010-01-20T21:30:08Z")

</div>

I have a site, where I am currently adding a self-built shop.

Among other stuff I have this construction in my route-file

map.namespace :shop do |shop|  
shop.resources :categories do |categories|  
categories.resources :products  
end  
end

I like the namespace, since it encapsulates the shop nicely inside my  
webapplication.

Somehow I would like the url “[http://mysite.com/shop](http://mysite.com/shop)” to map to the  
shop’s “frontpage”, which in my case is Categories#index

But I don’t know how to do it.

map.shop ‘/shop’, shop\_categories\_path  
doesn’t work

map.shop ‘/shop’, :controller =\> ‘categories’, :action =\> ‘index’  
misses the namespace

So what should I do?

- Carsten
