# UserEngine problem with nested controllers

**URL:** <https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599>\
**Category:** Engines\
**Created:** [May 25, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599 "2006-05-25T14:45:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![b0rdslide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@b0rdslide](https://www.ruby-forum.com/u/b0rdslide)\
**Post date:** [May 25, 2006, 2:45pm UTC](https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599/1 "2006-05-25T14:45:54Z")

</div>

Hi,

I ran into a bit of a problem recently with the UserEngine and nested  
controllers. The issue was that it got itself into an endless  
redirection loop whenever it tried to take the user to the login screen  
from a nested controller, it was trying to redirect to /admin/user/login  
instead of /user/login.

To fix the issue I replaced the login redirect in authorized\_system.rb  
to the following:

redirect\_to LoginSystem.config(:app\_url) + “/user/login”

This fixed the issue but is there a better way to do this?

Kev

---

<div class="post-metadata">

**Author:** ![b0rdslide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@b0rdslide](https://www.ruby-forum.com/u/b0rdslide)\
**Post date:** [May 25, 2006, 2:54pm UTC](https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599/2 "2006-05-25T14:54:50Z")

</div>

if you have something like this in environment.rb:

module LoginEngine  
config :login\_page, {:controller =\> ‘/user’, :action =\> ‘login’}  
end

… then the UserEngine should respect that.

HTH

- james

---

<div class="post-metadata">

**Author:** ![b0rdslide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@b0rdslide](https://www.ruby-forum.com/u/b0rdslide)\
**Post date:** [May 25, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599/3 "2006-05-25T15:02:39Z")

</div>

I do have this but it makes no difference, it still tries to redirect  
relative to the base controller (admin in this case). Redirects from  
controllers that aren’t nested work fine.

It’s a bit of an odd one, I think it may be related to Rails iteself  
rather than the UserEngine but I don’t know enough about Rails just yet  
to know where to start with debugging, or even if links/redirects work  
differently from within nested controllers.

Kev

---

<div class="post-metadata">

**Author:** ![b0rdslide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@b0rdslide](https://www.ruby-forum.com/u/b0rdslide)\
**Post date:** [May 25, 2006, 3:13pm UTC](https://www.ruby-forum.com/t/userengine-problem-with-nested-controllers/61599/4 "2006-05-25T15:13:40Z")

</div>

When creating links, a forward slash in front of the controller  
normally ensures that it links to controllers at the top level,  
outside of any module nesting… what you describe seems very odd! Can  
you work up a minimal test case, and send it along with details of  
your environment?

- james
