Skip to content

Commit cd1511b

Browse files
authored
Document that a custom Inspect implementation shows redacted fields (#4805)
1 parent 8760894 commit cd1511b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎lib/ecto/schema.ex‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ defmodule Ecto.Schema do
127127
128128
A field marked with `redact: true` will display a value of `**redacted**`
129129
when inspected in changes inside a `Ecto.Changeset` and be excluded from
130-
inspect on the schema unless the schema module is tagged with
131-
the option `@derive_inspect_for_redacted_fields false`.
130+
inspect on the schema, unless the schema derives or implements `Inspect`
131+
itself or the schema module is tagged with `@derive_inspect_for_redacted_fields false`.
132+
A schema that derives `Inspect` itself must exclude redacted fields
133+
explicitly, for example with `@derive {Inspect, except: [:password]}`.
132134
133135
A schema module tagged with `@schema_redact :all_except_primary_keys` will
134136
redact all fields except primary keys.

0 commit comments

Comments
 (0)