Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_child/1 fails to build a valid struct #5

Open
ghost opened this issue May 7, 2019 · 1 comment
Open

build_child/1 fails to build a valid struct #5

ghost opened this issue May 7, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented May 7, 2019

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)
@ghost ghost changed the title build/1 fails to build a valid struct build_child/1 fails to build a valid struct May 7, 2019
@ghost
Copy link
Author

ghost commented May 7, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants