Generic Rails Route Representation?
Posted
by Flemish Bee Cycle
on Stack Overflow
See other posts from Stack Overflow
or by Flemish Bee Cycle
Published on 2010-05-14T07:17:26Z
Indexed on
2010/05/14
9:44 UTC
Read the original article
Hit count: 315
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".
© Stack Overflow or respective owner