ecto_materialized_path
ecto_materialized_path copied to clipboard
`build_child/1` fails to build a valid struct
That is, the following test fails
test "build_child/1" do
comment = %Comment{id: 17, path: [89]}
assert %Comment{id: nil, path: [89, 17]} = Comment.build_child(comment)
end
with
1) test build_child/1 (DemoTest)
test/demo_test.exs:5
match (=) failed
code: assert %Comment{id: nil, path: [89, 17]} = Comment.build_child(comment)
right: %{__struct__: Demo.Comment, path: [89, 17]}
stacktrace:
test/demo_test.exs:7: (test)
A possible is it to take the parent struct and nillify all fields except for column_name
for path. Then the struct structure would be preserved.