-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
Fix/rails 7.1.2 compatibility #436
Conversation
Similar error in Rails
|
Experiencing the same issue. Thanks for posting the PR! |
thumbs up, bumped into this error in two different projects |
Having same issue |
This looks like a duplicate of #432 |
@rnestler, Yes, as I mentioned here:
I was an aware at that time, I added the tests for the PR, hopefully it will get merged soon 😊 , and I will close this PR, either way thanks for the remark. |
This PR's commits were cherry-picked to #440, and this fix was released: https://github.com/thoughtbot/factory_bot_rails/releases/tag/v6.4.2 Thank you for working on this! |
Thanks for working on this, can verify it's working now. |
Description
After upgrading to Rails 7.1.2, our application encounters a
NoMethodError
when attempting to accessconfig
on anil
object withinfactory_bot_rails
. This issue is reproduced when the application is booting and seems to be related to thefactory_bot_rails
Railtie initialization process.Environment
Error Output
Steps to Reproduce
factory_bot_rails
gem version 6.4.0.Expected Behavior
The application should boot without errors, and
factory_bot_rails
should correctly integrate with the Rails application configuration.Actual Behavior
The application fails to boot, raising a
NoMethodError
related toconfig
.Proposed Fix
The changes proposed in PR 8205851 seem to address the issue by ensuring that
config
is accessed in a way that is compatible with Rails 7.1.2's initialization process, I was not aware of the PR until now 😅 . It modifies the Railtie to defer the loading offactory_bot_rails
untilactive_record
is fully loaded, avoiding theNoMethodError
.I have applied the changes from the PR locally and confirmed that it resolves the error. This PR would be valuable for others who may face the same issue upon upgrading.
Additional Information
If there is any additional information or testing required, please let me know. I am willing to assist in any way to get this issue resolved.