orm
orm copied to clipboard
MorphMany relation cannot be accessed right after parent model `create`
Describe the bug
foo = Foo.create({...})
foo.some_morph_many_relation # AttributeError: class model 'Foo' has no attribute some_morph_many_relation
# but:
foo = foo.fresh() # after create
foo.some_morph_many_relation # works fine
Additional context Might be related to https://github.com/MasoniteFramework/orm/issues/750
This was the cause of this issue: https://github.com/MasoniteFramework/masonite/issues/693
I thought that it was tests framework related somehow, but it's the same thing. The @morph_many
relation isn't usable right after a create.