Forum: Rails Engines UserEngine problem with nested controllers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D9ff9c1eba9a908e3454d414b61f874f?d=identicon&s=25 Kevin Ansfield (b0rdslide)
on 2006-05-25 14:45
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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-05-25 14:54
(Received via mailing list)
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
D9ff9c1eba9a908e3454d414b61f874f?d=identicon&s=25 Kevin Ansfield (b0rdslide)
on 2006-05-25 15:02
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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-05-25 15:13
(Received via mailing list)
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
This topic is locked and can not be replied to.