# Problems with Restful resources with the same name

**URL:** <https://www.ruby-forum.com/t/problems-with-restful-resources-with-the-same-name/148032>\
**Category:** Ruby\
**Created:** [September 8, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/problems-with-restful-resources-with-the-same-name/148032 "2008-09-08T13:56:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeanluca](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/74df32/32.png) [@jeanluca](https://www.ruby-forum.com/u/jeanluca)\
**Post date:** [September 8, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/problems-with-restful-resources-with-the-same-name/148032/1 "2008-09-08T13:56:05Z")

</div>

Hi all,

I am trying to setup an application that has a management section and a  
client section with URLs as follows:

[http://mysite.com/manage/outlines/1](http://mysite.com/manage/outlines/1) - Management section with outline #1  
[http://mysite.com/outlines/1](http://mysite.com/outlines/1) - Client section with outline #1

Both refer to different controllers as follows:

app/controllers/outline\_controller.rb - Management controller  
app/controllers/clients/outline\_controller.rb - Client controller

Yep this is a bit confusing, but this is the only controller for the  
client section, where as the management section has about six.

For my routes I have the following:

map.resources :outlines, :member =\> { :edit2 =\> :get, :review =\> :get  
}, :path\_prefix =\> ‘/manage’ do |outline|  
outline.resources :sections, :member =\> { :delete =\> :get } do  
|section|  
section.resources :questions, :member =\> { :delete =\> :get } do  
|question|  
question.resources :options  
end  
end  
end

map.resources :outlines, :controller =\> ‘client/outlines’,  
:name\_prefix =\> ‘client\_’ do |outlines|  
outlines.connect ‘:key’, :action =\> ‘show’, :controller =\>  
‘client/outlines’  
outlines.connect ‘:key/:action’, :controller =\> ‘client/outlines’  
end

Now onto the problem. On my local development machine in development  
mode it runs perfect, but on my test machine (in production) it appears  
to exhibit some sort of caching bug.

If I go to [http://mysite.com/manage/outlines/1](http://mysite.com/manage/outlines/1) then  
[http://mysite.com/outlines/1](http://mysite.com/outlines/1), on the second page I just see the first  
page. I have tried restarting Mongrel a number of times but to no avail.  
BUT if I do it the other way around, going to  
[http://mysite.com/outlines/1](http://mysite.com/outlines/1) then [http://mysite.com/manage/outlines/1](http://mysite.com/manage/outlines/1)  
everything works perfectly.

I thought maybe this was something to do with the resources having the  
same name, so I changed the second block to the following:

map.with\_options :controller =\> ‘client/outlines’, :name\_prefix =\>  
‘client\_’ do |outlines|  
outlines.outline ‘/outlines/:id’, :action =\> ‘show’, :controller =\>  
‘client/outlines’, :conditions =\> { :method =\> :get }  
outlines.connect ‘/outlines/:id’, :controller =\> ‘client/outlines’,  
:action =\> ‘update’, :conditions =\> { :method =\> :put }

```
outlines.outline_with_key '/outlines/:id/:key', :action => 'show',

```

:controller =\> ‘client/outlines’, :conditions =\> { :method =\> :get }  
outlines.connect ‘/outlines/:id/:key/:action’, :controller =\>  
‘client/outlines’  
outlines.connect ‘/outlines/:id/:action’, :controller =\>  
‘client/outlines’  
end

This though still exhibits exactly the same behaviour. I have tried  
refreshing my browser, clearing the cache etc but no luck.

My local machine has:  
OS X Tiger 10.4.11  
Rails 2.1.0  
Mongrel 1.1.5

My test machine has:  
Ubuntu 8.04.1  
Rails 2.1.0  
Mongrel 1.1.5

Help please!
