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:
What is the opposite of url_for in Rails? A function that takes a path and generates the interpreted route?
ActionController::Routing::Routes.recognize_path("/posts")
So now I need to convert posts_path
into "/posts"
There's this method:
If you only have a string with your route (like
"posts_path"
), then I guess in the context you're using this you should be able to dobtw this was educating for me too :)
In Rails 3 you can do the following:
Using
ActionController::Routing::Routes.recognize_path
kept throwing