ja_resource v0.3.1 JaResource.Record behaviour

This behaviour is used by the following JaResource actions:

  • JaResource.Show
  • JaResource.Update
  • JaResource.Delete

It relies on (and uses):

  • JaResource.Records

Summary

Callbacks

Used to get the subject of the current action

Callbacks

record(arg0, arg1)

Specs

record(Plug.Conn.t, JaResource.id) ::
  Plug.Conn.t |
  JaResource.record

Used to get the subject of the current action

Many/most controllers will override this:

def record(%Plug.Conn{assigns: %{user_id: user_id}}, id) do
  model()
  |> where([p], p.author_id == ^user_id)
  |> Repo.get(id)
end