TL;DR: I’m upgrading an old middleware app from Phoenix 1.5 to 1.7 and I don’t speak Elixir. I’m looking for docs on migrating to Phoenix.Template.
So I read on this forum (Module Phoenix.View is not loaded and could not be found) that I can’t use Phoenix.View anymore. But now my web/views/contact_view.ex won’t compile since render_many/3
and render_one/3
no longer exist:
defmodule Redacted.ContactView do
use Redacted.Web, :view
def render("index.json", %{contacts: contacts}) do
%{data: render_many(contacts, Redacted.ContactView, "contact.json")}
end
def render("show.json", %{contact: contact}) do
%{data: render_one(contact, Redacted.ContactView, "contact.json")}
end
def render("contact.json", %{contact: contact}) do
%{id: contact.id,
email: String.slice(contact.email, 0..7),
redacted_response_code: contact.redacted_response_code}
end
end
Somebody must have noted somewhere how to do this properly.