Phoenix pattern match in controller

Viewed 667

I want to have 2 index functions in my controller, one if there is call with an id and one if there is an id with a search query string. For some reason the 2nd function is never called.

curl localhost:4000/something/15
curl localhost:4000/something/15?search=bob

def index(conn, %{"id" => id}) do
end

def index(conn, %{"id" => id}, "search" => search }) do
end
1 Answers
Related