session[:intended_controller] = controller_pathcontroller_path is an ActionController function which gives the fully qualified name for a controller. The documentation says
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_pathWrap this in an ApplicationController method and you're ready to roll. There's even a rails ticket for this issue, incidentally.