I couldn’t copy paste it… and I’m assuming this is the stack trace you’re talking about.
Thanks again.
I also believe one of the problem is my router.
65 scope "/admin", FumigateWeb.Admin, as: :admin do
66 pipe_through [:browser, :protected, :admin_only]
...
73 resources "/perfumes_approval", PerfumeApprovalController
74 post "/perfumes_approval", PerfumeController, :approve
75 end
I actually figured it out. It’s actually a combination of thing.
The router one where resources always matches, line 73, so line 74 never get to do anything.
Another thing is that edit is magic.
I don’t know how edit does it but it can take ecto stuff without complaining:
Routes.admin_perfume_approval_path(@conn, :edit, perfume)
I’m assuming update does the same thing.
So I’ve decided to fix the router problem by using one of the route/action I’m not using new
action instead of creating a custom action, approve
. On top of this instead of passing perfume
ecto as the third param I pass the record’s id instead:
Routes.admin_perfume_approval_path(@conn, :new, %{ "id" => perfume.id})
Thank you again for your time.