Ecto.Model.Callbacks

Parsed documentation:
View on GitHub
Define module-level callbacks in models.

A callback is invoked by your `Ecto.Repo` before (or after)
particular events. A callback must always return the given
module and they always run inside a transaction.

## Example

    defmodule User do
      use Ecto.Model.Callbacks

      after_create Stats, :increase_user_count

      def increase_user_count(user)
        # ...
      end
    end

When creating the user, the `after_create` callbacks will be
invoked with the `user` struct as argument. Multiple callbacks
can be defined, they will be invoked in order of declaration.

## Usage

Callbacks in Ecto are useful for data consistency, for keeping
counters, setting fields and so on. Avoid using callbacks for
business rules or doing actions unrelated to the data itself,
like sending e-mails.

Finally, keep in mind callbacks are not invoked on bulk actions
such as `Repo.delete_all` or `Repo.update_all`.
No suggestions.
Please help! Open an issue on GitHub if this assessment is incorrect.