Open vinhnglx opened 7 years ago
test/controllers/quote_controller_test.exs:109 ** (Protocol.UndefinedError) protocol Enumerable not implemented for %Sample.Quote
As this answer, the Enumerable requires a map, not a struct.
So, the code needs to change to
quote = %{quote: Repo.preload(quote, :user)} # A Map render(conn, "edit.html", quote: quote, changeset: changeset)
And the view will be @quote.quote.user and @quote.quote, because the @quote is a map.
@quote.quote.user
@quote.quote
@quote
<h2>Edit Quote</h2> <%= render "form.html", changeset: @changeset, types: @types, action: user_quote_path(@conn, :update, @quote.quote.user, @quote.quote) %> <%= link "Back", to: user_quote_path(@conn, :index, @quote.quote.user, @quote)
As this answer, the Enumerable requires a map, not a struct.
So, the code needs to change to
And the view will be
@quote.quote.user
and@quote.quote
, because the@quote
is a map.