Is there an inverse of 'url_for'

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://’
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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs