how do I tell the current controller correctly to redirect_to an action
of another controller that is 1 level higher in the folder hierarchy
than the current controller?
How I have tried: Within the current controller (called ‘incidents’), I
redirect_to :controller => ‘members’, :action => ‘show’, :id =>
(Where ‘members’ is 1 level higher. And this doesn’t work.)
Thank you for any help with this!
Are you creating subdirectories by hand and putting controllers in
them like normal, or are you properly namespacing them? e.g.:
IncidentsController < ApplicationController
Admin::IncidentsController < ApplicationController
My controller files contain:
class Admin::IncidentsController < ApplicationController
class MembersController < ApplicationController
- I am in the ‘Admin::IncidentsController < ApplicationController’, and
- redirect_to the ‘show’ action in the ‘MembersController <
I also tried something this:
redirect_to :controller => ‘…/members’, :action => ‘show’
Thanks for helping!
You should be able to do like this.
redirect_to :controller => “/members”, :action => ‘show’
Thanks, Kilari - that was it !