-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Generate seeds for HABTM associations #80
Conversation
I haven't had a chance to look at updating the specs. I did try to run the migrator spec, but it seemed to be broken due to other reasons. |
So even though this allows us to generate a seed with that implicit model, it seems like we can't actually run that generated seed successfully. I'm getting the following error
|
@pboling This branch is now working for me. Some points to consider though
Update: I'm planning to look into consolidating adding associations into a single statement, and also using sets to avoid generating associations both ways |
Addressed issues mentioned above
https://github.com/pboling/seed_migration/pull/80/files#diff-6652e1848792ce36ff90d5730fcc4de2252024499451356ce8764d918c9e4614R283-R299 adds a step to go through all registered models, and use a
This seems unnecessary, as these associations are only added if both models are registered. But it would not be too difficult to add this config option if needed.
This has been added, the seed generates statements to add necessary HABTM association ids in a single statement. |
If you have CI working in your fork, please send a PR with those fixes too! 🗡️ |
This PR addresses #34. The change add seeds for join tables for an HABTM association by iterating over all HABTM associations in a model.