Hello,
I have a function in my rack_detail_controller:
def delete(conn, %{"id" => id, "rack_id" => rack_id}) do
rack_detail = Repo.get!(Rack_detail, id)
Repo.delete!(rack_detail)
conn
|> redirect to: "/rack_details/#{rack_id}"
end
In my show.html.eex there’s:
link "", to: rack_detail_path(@conn, :delete, rack_detail.rack_details_id, rack_detail.rack_id), method: :delete, data: [confirm: "Are you sure?"], class: "icon-trash-empty delete-button"
The show.html.eex doesn’t even want to load itself and the error displays:
[error] #PID<0.404.0> running MdbmsWeb.Endpoint (cowboy_protocol) terminated
Server: localhost:4000 (http)
Request: GET /rack_details/1
** (exit) an exception was raised:
** (Protocol.UndefinedError) protocol Enumerable not implemented for 1. This protocol is implemented for: DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Postgrex.Stream, Range, Scrivener.Page, Stream
Is it possible to pass 2 values (rack_detail.rack_details_id and rack_detail.rack_id) to function delete in controller?