How to map a Named Route onto a namespaced resource?

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” 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs