Hi there, 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 have put: redirect_to :controller => ''members'', :action => ''show'', :id => @user.id (Where ''members'' is 1 level higher. And this doesn''t work.) Thank you for any help with this! Tom -- Posted via http://www.ruby-forum.com/.
Are you creating subdirectories by hand and putting controllers in them like normal, or are you properly namespacing them? e.g.: admin/incidents_controller.rb: IncidentsController < ApplicationController -or- admin/incidents_controller.rb: Admin::IncidentsController < ApplicationController -eric On Sep 19, 8:20 am, Tom Ha <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi there, > > 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 > have put: > > redirect_to :controller => ''members'', :action => ''show'', :id => > @user.id > > (Where ''members'' is 1 level higher. And this doesn''t work.) > > Thank you for any help with this! > Tom > -- > Posted viahttp://www.ruby-forum.com/.
Hi Eric, My controller files contain: controllers/admin/incidents_controller.rb: class Admin::IncidentsController < ApplicationController ... end controllers/members_controller.rb: class MembersController < ApplicationController ... end - I am in the ''Admin::IncidentsController < ApplicationController'', and need to - redirect_to the ''show'' action in the ''MembersController < ApplicationController'' I also tried something this: redirect_to :controller => ''../members'', :action => ''show'' Thanks for helping! -- Posted via http://www.ruby-forum.com/.
Anyone...? -- Posted via http://www.ruby-forum.com/.
Vamsi krishna Kilari
2009-Sep-20 23:00 UTC
Re: How to: redirect_to through a folder hierarchy (upwards)
Tom, You should be able to do like this. redirect_to :controller => "/members", :action => ''show'' Thanks, Kilari. http://kilari.co.in -- Posted via http://www.ruby-forum.com/.