I used "mix phoenix.gen.json" to generate the code for rendering json resulting in view below:
defmodule Pghm.SightingsView do
use Pghm.Web, :view
def render("sighting.json", %{sighting: sighting}) do
%{what: sighting.what,
lat: sighting.lat,
long: sighting.long}
end
def render("index.json", %{sightings: sightings}) do
%{data: render_many(sightings, Pghm.SightingsView, "sighting.json")}
end
def render("show.json", %{sighting: sighting}) do
%{data: render_one(sighting, Pghm.SightingsView, "sighting.json")}
end
end
However when I attempt to access call it I receive: Could not render "sighting.json" for Pghm.SightingsView, please define a matching clause for render/2 or define a template at "web/templates/sightings". No templates were compiled for this module. Assigns:
Everywhere I've looked indicates that this should work, but I get no love.