Skip to content

Instantly share code, notes, and snippets.

@bigtiger
Created June 3, 2009 13:29
Show Gist options
  • Save bigtiger/122982 to your computer and use it in GitHub Desktop.
Save bigtiger/122982 to your computer and use it in GitHub Desktop.
# Reparse a URL to get a hash of route params.
>> url ="/New-Homes/Search/Georgia/Atlanta/townhome-5000000-maximum-price-100000-minimum-price-5d6qe+5d6tw+5d6sv"
=> "/New-Homes/Search/Georgia/Atlanta/townhome-5000000-maximum-price-100000-minimum-price-5d6qe+5d6tw+5d6sv"
>> ActionController::Routing::Routes.recognize_path(url)
=> {:state=>"Georgia", :action=>"index", :refinement=>"townhome-5000000-maximum-price-100000-minimum-price-5d6qe+5d6tw+5d6sv", :city=>"Atlanta", :controller=>"communities", :channel=>"Search"}
# Note: The New-Homes segment is a prefix in our routes and not returned in the params.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment