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

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

Link to this section Summary

Callbacks

Used to get the subject of the current action

Link to this section Callbacks

Specs

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