Phoenix, like Rails, gives you the option to specify a resource in your routes in order to generate the typical CRUD actions we deal with in a controller. The dynamic segment which identifies the resource is
:id by default.
resources "orders", OrderController
update route would look like this if we run
order_path PATCH /orders/:id MyApp.OrderController :update
If our table doesn’t use “id” as a primary key, or we want to change the field we use to find our resource, we can specify it as an option in our route:
resources "orders", OrderController, param: "some_field"
Now our route is updated:
order_path PATCH /orders/:some_field MyApp.OrderController :update