View Source ExTeal.Resource.Record behaviour (ExTeal v0.27.0)

This behaviour is used by the following ExTeal.Resource actions:

  • ExTeal.Resource.Show
  • ExTeal.Resource.Update
  • ExTeal.Resource.Delete

It relies on (and uses):

  • ExTeal.Resource.Records

Summary

Callbacks

Used to get the subject of the current action

Callbacks

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