# Nested Controllers - Development vs. Production

**URL:** <https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645>\
**Category:** Rails\
**Created:** [December 31, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645 "2007-12-31T14:36:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [December 31, 2007, 2:36pm UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645/1 "2007-12-31T14:36:40Z")

</div>

I have an infuriating problem!

Very excited about my app, working well and then I dropped it into  
production (first deployment) and it continued to operate at first as  
expected (I’ve learned an awful lot in the last 6 months and I was very  
pleased).

I’m not sure what’s changed but now my redirect statements have gone  
screwy, I’ve tried and tried to fix it but without success, so I’ve now  
come here for some expert advice. Various redirects are giving me “The  
page you were looking for doesn’t exist”, when the local version works -  
the url is the same in both environments.

For now I’ve reset the things I’ve been playing with (routes file /  
environment settings, various others) back to their defaults. I figure  
this is caching / paths / relative paths or my biggest suspicion the  
routes file. I want to stress that my app works fine on my Mac in  
development, with a vanilla routes file. I’m pretty sure I’ve deployed  
correctly.

I have attached a picture showing the structure of the directories, so  
you can see my controllers.

An example redirect that works at home but not away would be this in my  
signup controller…

redirect\_to(:controller =\> ‘/owner/welcome’, :action =\> ‘index’)

My question is primarily, do I need to touch the routes file to get this  
to work in production and if so, what edit do I make OR is it perhaps  
something else I haven’t considered yet?

I’d be very grateful if someone could solve this one for me or perhaps  
point me in the right direction.

Rgds,

bb

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [December 31, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645/2 "2007-12-31T16:02:57Z")

</div>

After some testing (and a default route file) I see this as the  
problem…

With this in the controller…redirect\_to(:controller =\>  
‘/owner/welcome’, :action =\> ‘index’)

interesting result…worked in dev…logged this in the log  
Parameters: {“action”=\>“index”, “controller”=\>“owner/welcome”}  
and page is rendered correctly…

in production i do the same actions and get the error rendered in the  
browser

“The page you were looking for doesn’t exist.”

This is what i see in the log…  
Parameters: {“action”=\>“welcome”, “controller”=\>“owner”}

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [December 31, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645/3 "2007-12-31T18:18:46Z")

</div>

anyone ?

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [December 31, 2007, 10:26pm UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645/4 "2007-12-31T22:26:46Z")

</div>

On 12/31/07, Rupert F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> An example redirect that works at home but not away would be this in my  
> signup controller…
> 
> redirect\_to(:controller =\> ‘/owner/welcome’, :action =\> ‘index’)

Why do you need to put controllers in directories like that? Is there  
any reason why you can’t put it in the normal controllers directory  
and just make a custom route so the url _appears_ like you want?

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [January 1, 2008, 10:05am UTC](https://www.ruby-forum.com/t/nested-controllers-development-vs-production/124645/5 "2008-01-01T10:05:02Z")

</div>

I hadn’t realised it wasn’t a good thig to do. I do now.

I’ve restructured it, and it’s working much better now - in production  
also.

Getting closer…

Not sure how to organise my Admin controller though as it needs CRUD  
actions for BOTH owners AND properties…and ci cannot have two  
actions of the same name in a single admin controller.

Any tips?
