You can't directly find the referring action/controller, but you can get the referring URL.
request.referrer The problem in trying to determine the referring action from this is you have no knowledge of the verb used on the referring URL. For example /products could be the products index action (GET), or the create action (POST). HTTP is stateless by nature, so the only way to know the action truly would be to hack your own state into the session. You could then set the last action in the cookie as an after_filter, but that would be rather heavy handed. Perhaps it's better to review why you need that info & from there come up with a different solution. Niels On Jan 27, 2010, at 7:55 AM, Tom Ha wrote: > Hi there, > > I'm posting because I didn't find the answer using search engines: > > How do I get the name of the action and/or controller that have sent the > user to the current page? > > (I know one can access the *current* action/controller using > controller.controller_name and controller.action_name, but I need to > retrieve the the *referring* action/controller, meaning "the one > before"...) > > Thanks a lot for any help! > Tom > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

