mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 05:23:18 +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]} ->
|
||||
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)
|
||||
|
||||
{:ok, record}
|
||||
|
|
|
@ -519,8 +519,6 @@ defmodule AshPostgres.CalculationTest do
|
|||
end
|
||||
|
||||
test "nested get_path works" do
|
||||
Logger.configure(level: :debug)
|
||||
|
||||
assert "thing" =
|
||||
Post
|
||||
|> Ash.Changeset.new(%{title: "match", price: 10_024, stuff: %{foo: %{bar: "thing"}}})
|
||||
|
|
Loading…
Reference in a new issue