Is there a way of extracing controller name from a URL?
I don't think so because the url could be completely different from
the controller path because of routes. There's
'controller.controller_name' or 'controller.controller_path' (http://
you can use to figure which controller's being used from within the
My situation is slightly different. I want to look at
request.env['HTTP_REFERER'] and take a different action based on what
is stored in it. For example if the URL belongs to controller a, then
take one action and if its controller b then take a different action.
params[:controller] will give you the controller name.
params[:action] will give you the action name.