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

The override params with association fields is not working properly #247

Open
kevin-nguyen-goldenowl opened this issue Feb 12, 2025 · 0 comments

Comments

@kevin-nguyen-goldenowl
Copy link

kevin-nguyen-goldenowl commented Feb 12, 2025

Here’s is my case.

  • Expectation: Create a comment with the existing post

  • Reality: Create a comment with the existing post and create a random post from the comment factory

  • Post factory

Image
  • Comment factory
Image
const existingPost = await factory(Post)().create();
const comment = await factory(Comment)().create({post: existingPost});

When I pass the existing post via the override params, it will attach the existing post to the comment, but the comment always creates a random post by default, which I don’t want. I think we should check if the override params don’t contain the association, then create the default; that will make sense.

Can anyone help me on this? Thank you

Image
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

1 participant