ja_resource v0.2.0 JaResource.Model behaviour

Provides the model/0 callback used to customize the resource served.

This behaviour is used by all JaResource actions.

Summary

Callbacks

Must return the module implementing Ecto.Schema to be represented

Functions

model_from_controller(module)

Callbacks

model()

Specs

model :: module

Must return the module implementing Ecto.Schema to be represented.

Example:

def model, do: MyApp.Models.Post

Defaults to the name of the controller, for example the controller MyApp.V1.PostController would serve the MyApp.Post model.

Used by the default implementations for handle_create/2, handle_update/3, and records/1.