ja_resource v0.2.0 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
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