Let\'s say I want to create a resources
with adding a couple of custom actions to it, the analogue in rails is:
resources :tasks do
member do
Here is another solution:
scope "/tasks" do
get "/:id/implement", TasksController, :implement
get "/done", TasksController, :done
end
resources "/tasks", TasksController
The implement
action has a member route and the done
action has a collection route.
You can get the path for the former with this function call:
tasks_path(@conn, :implement, task)
Note that you should place the resources
line after the scope
block. Otherwise, the Phoenix recognizes /tasks/done
as the path for show
action.