Accessing the name of a controller's module?

If I’m redirecting to a log in page, and saving the controller and
action name in the session hash, how do I also save the controller
module?

After the log in is completed, I can’t redirect back to the originally
directed page because it’s in a different controller module. For the
controller action name I can use the ActionController instance method
controller_name(), and looking at the API docs there is a class method
called controller_path() that I have been trying to use, but no
corresponding instance method that I could use. I might just not know
the right syntax.

My redirect code is:

unless session[:user]
session[:intended_location] = action_name
session[:intended_controller] = controller_name
flash[:notice] = “You must log in to continue.”
redirect_to :controller => “/account”, :action => “log_in”
end

Then once the action I’m redirected to is completed I use this code to
return the user to the appropriate original page:

  redirect_to :action => session[:intended_action],
              :controller => session[:intended_controller]

Do I need a line that works like:

session[:intended_module] = module_name

Or am I totally barking up the wrong tree and should not be
redirecting in and out of modules? It seems repititious to have
different log in methods for each module.

On 7/8/06, Jim L. [email protected] wrote:

If I’m redirecting to a log in page, and saving the controller and
action name in the session hash, how do I also save the controller
module?

Sorry, I missed the answer to a similiar question which was given
yesterday.

Trevor S. [email protected] Said:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs