mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
fix: don't clobber loaded data on update
This commit is contained in:
parent
9ae51b6c06
commit
9f77304b22
2 changed files with 7 additions and 2 deletions
|
@ -1993,6 +1993,13 @@ defmodule AshPostgres.DataLayer do
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{1, [record]} ->
|
{1, [record]} ->
|
||||||
|
record =
|
||||||
|
changeset.resource
|
||||||
|
|> Ash.Resource.Info.attributes()
|
||||||
|
|> Enum.reduce(changeset.data, fn attribute, data ->
|
||||||
|
Map.put(data, attribute.name, Map.get(record, attribute.name))
|
||||||
|
end)
|
||||||
|
|
||||||
maybe_update_tenant(resource, changeset, record)
|
maybe_update_tenant(resource, changeset, record)
|
||||||
|
|
||||||
{:ok, record}
|
{:ok, record}
|
||||||
|
|
|
@ -519,8 +519,6 @@ defmodule AshPostgres.CalculationTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "nested get_path works" do
|
test "nested get_path works" do
|
||||||
Logger.configure(level: :debug)
|
|
||||||
|
|
||||||
assert "thing" =
|
assert "thing" =
|
||||||
Post
|
Post
|
||||||
|> Ash.Changeset.new(%{title: "match", price: 10_024, stuff: %{foo: %{bar: "thing"}}})
|
|> Ash.Changeset.new(%{title: "match", price: 10_024, stuff: %{foo: %{bar: "thing"}}})
|
||||||
|
|
Loading…
Reference in a new issue