Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kyleroberthammond/2952f3772d95f1126533794c44870571 to your computer and use it in GitHub Desktop.
Save kyleroberthammond/2952f3772d95f1126533794c44870571 to your computer and use it in GitHub Desktop.
Previous Path / Get path helper name of a url
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment