views:

34

answers:

0

Given one or more instances of a model (AR or DM, whatever). Is it possible to generate the route in the requirement form, by which I mean "/foos/:id"

Given the route:

resource :foo do
  resource :bar
end

generate_route_method [@foo,@bar] -> "/foos/:id/bars/:id"

I'm not talking about #foos_path or #polymorphic_path, rather, literally generating the string containing the wildcard components (i.e ":id"), the same as it would appear as if you did "rake routes".