Yes, the absolute link or the absolute :controller
spec did work, but in the end for other reasons that
"sub-app" needed to be split out anyway, and although
there may be a little bit of code overlap in the end,
everything else is notably smoother now.

Thanks...

        -glenn

Patrick Crowley wrote:
Try this instead, Glenn:

 def access_denied
   ...stuff...
   redirect_to '/sessions/new'
   ...
 end

....

I suspect this will be the only patch you'll need to make.

If you need to link to any non-nested controllers, just use absolute links in your link_to functions and maybe include such links in a partial to keep things DRY.

Otherwise, nested directories are fine... as long as they're used in moderation. But if you have find yourself with more than 10 nested controllers, or you find yourself duplicating large parts of your app (say, for an admin interface), I'd think twice.

-- Patrick


On Jul 24, 2007, at 4:58 AM, Glenn Little wrote:

I've got a situation where I have some controllers
nested one level deeper than "standard":

 app/controllers/nestfolder/blah_controller.rb

I'm also running the restful auth package.

The problem I'm having is that restful auth is not creating
redirects correctly given the nesting structure.  I'm still
at the beginning, so I'm starting with the :login_required
before_filter.  This calls access_denied to redirect to the
login page:

 def access_denied
   ...stuff...
   redirect_to :controller => 'sessions', :action => 'new'
   ...
 end

The problem is that when this is triggered from one of the
nested controller actions, the :controller in the redirect
automatically inherits the nesting, so the app tries to
redirect to "nestfolder/sessions", which is incorrect.

I've found that I can get it to generate the correct redirect by
specifying :controller => "/sessions".
My question is, what is the "right" way to fix the problem?
Hunt down all the redirects, url_for calls, link_to
calls etc. in Restful Auth and modify them?  Anyone know of
any alternatives?

Maybe I'm not doing the controller nesting correctly?  I used
radrails to do a "generate", which appears to be the same as
"script/generate nestfolder/blah_controller".  Am I just asking
for trouble by nesting controllers one level deeper like that
in general?

Thanks for any insight or advice.

        -glenn
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to