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

Set foreign keys on children from associated parents when building #479

Closed
mattwynne opened this issue Dec 13, 2024 · 4 comments
Closed

Comments

@mattwynne
Copy link

We're working in a context where we are creating associated records in our factories, and we set the parent record's ID as we build them.

e.g.

Factory.build(:wheel, 
  car: Factory.build(:car, car_id: "some-car-id")
)

We have noticed that when we use Factory.insert, wheel.car_id is set. We would like that same behaviour from build.

We've got a patch for this locally in our codebase, would it be useful to submit as a PR?

Copy link
Contributor

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet.
If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

@doomspork
Copy link
Member

@mattwynne if you wouldn't mind opening a PR I'd be glad to look at the solution and discuss getting it into the repo if it makes sense!

Copy link
Contributor

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet.
If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

Copy link
Contributor

github-actions bot commented Mar 4, 2025

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants