Redirecting to a controller in a different module

The other day I was trying to figure out how redirect to a Controller in a different module. I kept trying something like
session[:intended_controller] = controller_path
controller_path is an ActionController function which gives the fully qualified name for a controller. The documentation says

controller_path()
Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".


What they don't mention is that this is a class method of ActionController::Base and so can only be invoked as
self.class.controller_path
Wrap this in an ApplicationController method and you're ready to roll. There's even a rails ticket for this issue, incidentally.
Post a Comment