-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Associations blocks are being executed with invalid data at attributes_for #1589
Comments
Unfortunately, giving a block to In addition, there is a deep rooted assumption in the code base that an association cannot be passed a block, it can only have traits and attribute overrides. Maybe this factory :post do
body { "the post body" }
author
blog { association :blog, authors: [author] }
end |
Do you think it'd make sense for |
Description
Hi team!
I noticed that FactoryBot is executing the associations block even when I'm using
attributes_for
.When I have one block which depends on another association, ruby is going to generate an
undefined method "the-association-name" for nil:NilClass
.I expected that the associations blocks weren't executed.
Thanks. You're great 💜!
Reproduction Steps
Expected behavior
I expected that the associations blocks weren't executed or the associations data were valids.
Actual behavior
The associations blocks are being executed with invalid data.
The text was updated successfully, but these errors were encountered: