# Specific routing problem

**URL:** <https://www.ruby-forum.com/t/specific-routing-problem/178054>\
**Category:** Rails\
**Created:** [October 28, 2009, 4:28pm UTC](https://www.ruby-forum.com/t/specific-routing-problem/178054 "2009-10-28T16:28:22Z")\
**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:** [October 28, 2009, 4:28pm UTC](https://www.ruby-forum.com/t/specific-routing-problem/178054/1 "2009-10-28T16:28:22Z")

</div>

I am implementing a system for users to easily create a small shop for  
themselves. And I’ve run into a route problem.

NOTE: I’ve removed a lot from my route.rb file, since I want focus on  
this particular problem. 🙂

I currently have a route.rb like this:

ActionController::Routing::Routes.draw do |map|  
map.resources :shops do |shops|  
shops.resource :cart, :member =\> { :clear =\> :put } do |cart|  
cart.resources :items  
end  
end  
end

This makes possible URLs like these:

[http://myshop.com/shop/13](http://myshop.com/shop/13)  
[http://myshop.com/shop/13/cart](http://myshop.com/shop/13/cart)  
[http://myshop.com/shop/13/cart/items](http://myshop.com/shop/13/cart/items)  
[http://myshop.com/shop/13/cart/clear](http://myshop.com/shop/13/cart/clear)  
etc.

The thing is, I really want URLs where the first keyword “shop” is  
removed, ie:

[http://myshop.com/13](http://myshop.com/13)  
[http://myshop.com/13/cart](http://myshop.com/13/cart)  
[http://myshop.com/13/cart/items](http://myshop.com/13/cart/items)  
[http://myshop.com/13/cart/clear](http://myshop.com/13/cart/clear)

Or - better still - every shop has a nickname, so it should be

[http://myshop.com/davids-modeltrains](http://myshop.com/davids-modeltrains)  
[http://myshop.com/davids-modeltrains/cart](http://myshop.com/davids-modeltrains/cart)  
[http://myshop.com/diamonds-for-all/cart/clear](http://myshop.com/diamonds-for-all/cart/clear)  
etc.

Using a nickname instead of an ID is not the problem for me. My problem  
is, I cannot find out how to make my route.rb, to fit this.

I hope somebody can help.

Thanks

- Carsten
