Skip to content

Commit 21a626d

Browse files
committed
Ensure that we detect writable violation which set a field to nil
1 parent 16670ce commit 21a626d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/ecto/repo/schema.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,12 @@ defmodule Ecto.Repo.Schema do
627627

628628
defp drop_non_writable_changes!(changes, non_writable_fields, schema, action) do
629629
Enum.reduce(non_writable_fields, changes, fn field, changes ->
630-
case Map.pop(changes, field) do
631-
{nil, changes} ->
632-
changes
633-
{_change, changes} ->
630+
case changes do
631+
%{^field => _change} ->
634632
handle_writable_violation(field, schema, action)
635633
changes
634+
%{} ->
635+
changes
636636
end
637637
end)
638638
end

0 commit comments

Comments
 (0)