AuditTrail. Diff
(audit_trail v0.1.1)
Copy Markdown
Computes field-level diffs from Ecto changesets.
Associations (has_many/has_one/belongs_to/many_to_many) and embeds
(embeds_one/embeds_many) are represented by Ecto as nested
%Ecto.Changeset{} structs (or lists of them) inside the parent
changeset's changes. Those are diffed recursively instead of being
dumped as an opaque struct, so a field-level before/after is captured for
the parent and anything nested under it.
A nested schema can opt into its own field-level filtering by adding
use AuditTrail.Schema, track: [...] to the embedded/associated schema
module itself — the parent's track: list only ever filtered top-level
fields, so this is what makes track: meaningful for what's inside an
embed/assoc. Nested schemas that don't declare it keep the old
behavior (every nested field included once the parent field is tracked).