Phoenix.View.render_many
You're seeing just the function
render_many
, go back to Phoenix.View module for more information.
Renders a collection.
A collection is any enumerable of structs. This function returns the rendered collection in a list:
render_many users, UserView, "show.html"
is roughly equivalent to:
Enum.map(users, fn user ->
render(UserView, "show.html", user: user)
end)
The underlying user is passed to the view and template as :user
,
which is inferred from the view name. The name of the key
in assigns can be customized with the :as
option:
render_many users, UserView, "show.html", as: :data
is roughly equivalent to:
Enum.map(users, fn user ->
render(UserView, "show.html", data: user)
end)