You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If you try to call the attach method to connect two model instances that are in a many to many relation, the following error is raised:
Describe the bug
If you try to call the
attach
method to connect two model instances that are in a many to many relation, the following error is raised:To Reproduce
This happens because the
BelongsToMany
classattach
method access builder without checking whether it is initialized or not:orm/src/masoniteorm/relationships/BelongsToMany.py
Line 366 in 798de75
One workaround is to call
get_builder()
before callingattach
:but I think the proper fix would be to change the
BelongsToMany
method in this way:Expected behavior
The entities should be connected in the relation without issues.
Desktop (please complete the following information):
What database are you using?
The text was updated successfully, but these errors were encountered: