Closed adonig closed 3 months ago
Did ExMachina get abandoned? That would be kind of sad 😞
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.
Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!
Description
I encountered an issue in my test setup where a parameter is unexpectedly set by insert_belongs_to_assocs/2, causing a test case to fail.
Current Behavior
Here's the test snippet:
The IO.inspect/1 outputs the following, showing that source_id is set to a valid hash, rather than the intended "invalid":
Proposed Solution
To address this, I propose passing the attrs to insert_belongs_to_assocs/2 to check if the owner_key is already present in attrs before calling insert_build_belongs_to_assoc/3. This change would skip association insertion when the owner_key is explicitly provided, allowing for more controlled test setups and preventing unintended data setup.
Here’s a suggested modification to lib/ex_machina/ecto.ex:
I am happy to submit a PR if this solution aligns with the project's goals.
Let me know if you need further modifications or additional details for the issue!