Path parsing in rails

Posted by fl00r on Stack Overflow See other posts from Stack Overflow or by fl00r
Published on 2010-04-26T15:55:13Z Indexed on 2010/04/26 16:23 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

Hi! I am looking for method for parsing route path like this:

ActionController::Routing.new("post_path").parse
#=> {:controller => "posts", :action => "index"}

It should be opposite to url_for

Upd
I've found out: http://stackoverflow.com/questions/2222522/what-is-the-opposite-of-url-for-in-rails-a-function-that-takes-a-path-and-genera

ActionController::Routing::Routes.recognize_path("/posts")

So now I need to convert posts_path into "/posts"

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails