thoughtbot / factory_bot_rails

Factory Bot ♥ Rails
https://thoughtbot.com/services/ruby-on-rails
MIT License
3.06k stars 364 forks source link

Fix undefined method config #440

Closed benoittgt closed 9 months ago

benoittgt commented 9 months ago

Hello

This PR makes last version of factory_bot_rails working with Rails and other gems like database_cleaner-active_record when ActiveRecord::Base is loaded too early. Also the code is tested on last Rails version with the work of @y-yagi. I choose to cherry pick the commit because of great job.

I added a test that reproduce exactly the error and could behave as a non-regression test. Without the patch:

Screenshot 2023-11-23 at 12 45 29

Fix: #432 Fix: #436 Close: #429

For me the code of this gem is not bad, it's because of other gem that we have errors. See recommendations and discussions on this subject: https://github.com/rails/rails/issues/46567

cc @mike-burns

benoittgt commented 9 months ago

Thanks a lot @neilvcarvalho and @matsales28. Do you plan to make a release? ✨

neilvcarvalho commented 9 months ago

@benoittgt Working on it right now, and should be up in a few minutes

neilvcarvalho commented 9 months ago

Released on https://github.com/thoughtbot/factory_bot_rails/releases/tag/v6.4.2 - thank you for working on this!

benoittgt commented 9 months ago

Thank you so much 🙌