Alex,
Try this method (adapted from the assert_routing tests):
def path_parameters_from_path(path, request_method)
request = ActionController::TestRequest.new({}, {}, nil)
request.env["REQUEST_METHOD"] = request_method.to_s.upcase if
request_method
request.path = path
ActionController::Routing::Routes.recognize(request)
request.path_parameters
end
Use it like this...
path_parameters_from_path("/books/1", :get)
path_parameters_from_path("/books/1", :put)
-christos
On 29 Nov 2006, at 12:51, Alex MacCaw wrote:
>
> I was wondering whether it would be possible to invoke a route
> directly
> from inside rails from a url.
> In other words, I have a url
> ''http://localhost:3000/webdav/number1/folder'' and I
don''t want to have
> to go through the trouble of parsing it manually. Is there some rails
> method I can call to parse it, giving an array of params?
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---