abiwinanda / fictitious

Generate fictitious data in elixir for unit test
https://hex.pm/packages/fictitious
MIT License
14 stars 3 forks source link

Add support for self referencing association #1

Closed bedhilzz closed 4 years ago

bedhilzz commented 4 years ago

Previously, it doesn't support the self referencing association, let say a User has a parent which references to the User, it will then always recursively creating the parent, resulting an endless loop.

Since the creation is using recursive method, I add that support by checking whether the owner & related field in Ecto.Association.BelongsTo has a same value (add base case for the recursive function).

abiwinanda commented 4 years ago

This is exactly what I need :) 👍