Phoenix path helpers - getting undefined function my_path/4

Phoenix router helpers are perhaps one of the most confusing things in the docs (just my perspective).

Here’s a route:
get “/name”, MyController, :function

I want to pass parameters https://localhost:4000/name?this=that

I’ve tried to use
link( “link”, to: my_path( conn, :function, “name”, this: that ), method: get )

But I get undefined function my_path/4

How do you use a path helper with four arguments?

Aha, didn’t need the 3rd parameter!

ink( “link”, to: my_path( conn, :function, this: that ), method: get )

The name part of the url gets added by the helper auto-magically


Yep, though it is to let you re-path things all you want not having to change the action names anywhere. :slight_smile: