Skip to content
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

MorphMany relation cannot be accessed right after parent model create #753

Open
os-nikita opened this issue Jul 8, 2022 · 1 comment
Open
Labels
bug An existing feature is not working as intended

Comments

@os-nikita
Copy link

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 #750

@os-nikita os-nikita added the bug An existing feature is not working as intended label Jul 8, 2022
@os-nikita os-nikita changed the title MorphMany relation cannot be access right after parent model create MorphMany relation cannot be accessed right after parent model create Jul 8, 2022
@os-nikita
Copy link
Author

os-nikita commented Jul 18, 2022

This was the cause of this issue: MasoniteFramework/masonite#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An existing feature is not working as intended
Projects
None yet
Development

No branches or pull requests

1 participant