Thursday, July 03, 2008

Rails: Get controller route hash from url string

This is somewhat uncommon, but to get the routing hash from a URL string:

ActionController::Routing::Routes.recognize_path('/users/1')
# => {:controller => 'users', :action => 'show', :id => '1' }

4 comments:

Anonymous said...

This is great! Thanks a lot!

Anonymous said...

Thank you. It's people like you that make coding pleasant.

Anonymous said...

THX!!!!

Unknown said...

You are my sunshine. My only sunshine. You make me happy when skies are blue.