Hr.JWTView

Summary

Functions

Returns true whenever the list of templates changes in the filesystem

The resource name, as an atom, for this view

Returns the template root alongside all templates

def render("index.json", %{posts: posts}) do %{posts: render_many(posts, PeepBlogBackend.PostView, "post.json")} end

Callback invoked when no template is found. By default it raises but can be customized to render a particular template

Functions

__phoenix_recompile__?()

Returns true whenever the list of templates changes in the filesystem.

__resource__()

The resource name, as an atom, for this view

__templates__()

Returns the template root alongside all templates.

render(template, assigns \\ %{})

def render("index.json", %{posts: posts}) do %{posts: render_many(posts, PeepBlogBackend.PostView, "post.json")} end

def render("show.json", %{post: post}) do %{post: render_one(post, PeepBlogBackend.PostView, "post.json")} end

defmodule PeepBlogBackend.ChangesetView do use PeepBlogBackend.Web, :view

def render("error.json", %{changeset: changeset}) do # When encoded, the changeset returns its errors # as a JSON object. So we just pass it forward. %{errors: changeset} end end

template_not_found(template, assigns)

Callback invoked when no template is found. By default it raises but can be customized to render a particular template.