Forum: Ruby on Rails is there an inverse of 'url_for'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Scott N. (Guest)
on 2006-02-05 18:23
What I want to do is take a url string (from a file,db,form field,...)
and turn it into a hash.

For example:
string = 'proto://host.com/posts/show/10?user=joe'
url_to_hash(string) #=> {:controller => 'posts', :action => 'show', :id
=> 10, :user => 'joe'}

Does rails have anything like this already built in, or a simple way of
doing this?

If not:

How does rails take the url and create the params[] hash?
On line 458 in routing.rb in the rails source there is a line

"hash = recognize_path(path)"

which looks like it MIGHT be doing the same thing that I want. I just
can't figure out how to access that function to test this.
This topic is locked and can not be replied to.