The opposite of url_for?

Hi,

I have a URL value (session[:return_to]) that I want to derive the
action and controller from. Essentially what the routing system does
for an actual web request when it puts together the params hash.

My search-foo is letting me down. What is the best method to get back
the action and controller from a URL?

TIA,
Walter

On Thu, Nov 4, 2010 at 8:59 AM, Walter McGinnis
remo[email protected]wrote:

My search-foo is letting me down. What is the best method to get back
the action and controller from a URL?

ActionController::Routing::Routes.recognize_path(path, method).


Erol M. Fornoles
http://github.com/Erol
http://twitter.com/erolfornoles
http://ph.linkedin.com/in/erolfornoles

To answer my own question:

from_url = ActionController::Routing::Routes.recognize_path(url,
:method => :get)

Returns a hash of what I was after.

Cheers,
Walter

On Thu, Nov 4, 2010 at 1:59 PM, Walter McGinnis

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