But I do not find one that gives me the path function created by the Router. Is there a way to get it back?. For example, given: "/api/v1/pages/:id"
get api_v1_page_path
or Routes.api_v1_page_path
or {Routes, :api_v1_page_path, arity_something}
Hi @cenotaph, thanks for your reply. What I’m trying to do is a little different. I want to grab (or capture) at runtime the {controller_name}_path name function that the Router previously created at compile time. I other words, inside my controller use “something” to capture
{Routes, :{controller_name}_path, arity}
Note the second element in the Tuple is an atom.
The closest result so far is using Phoenix.Controller.current_path(conn) --obviuosly if I’m inside of the Controller Module I can call it directly, in other words just current_path(conn). Another approach is to use
The generated route above will match on the path "/api/v1/pages/:id" and will dispatch to :show action in API.V1.PageController . A named helper api_v1_page_path will also be generated.