It can be helpful to know what controller or actions name the previous request had. This is a nice clean method to get that information.
Rails.application.routes.recognize_path(request.referrer) #=> {:controller => "posts", :action => "show"}
prev[:action] #=> "show"
prev = Rails.application.routes.recognize_path(request.referrer)
prev[:controller] #=> "posts"
Related External Links: