-
Notifications
You must be signed in to change notification settings - Fork 64
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
Issue with the upcoming Factory Bot Rails due to lacking of lazy load hooks #89
Comments
tagliala
changed the title
Issue with the upcoming Factory Bot Rails due to
Issue with the upcoming Factory Bot Rails due to lacking of lazy load hooks
Nov 1, 2023
Hopefully this will be addressed by Factory Bot Rails itself in thoughtbot/factory_bot_rails#432 |
@tagliala Having the same issue here, this issue happens for me regardless of factory bot rails version used and appears totally unrelated to factory bot rails |
Please try with the branch used in thoughtbot/factory_bot_rails#432 |
I think this gem should follow lazy loading like other project: |
benoittgt
added a commit
to benoittgt/database_cleaner-active_record
that referenced
this issue
Nov 23, 2023
This is well known issue. We should prefer to code that reference active record only when it's already lazy loaded. It can break other gems initializing process Related: - rails/rails#46567 - paper-trail-gem/paper_trail@fc6c5f6 (inspiration) - thoughtbot/factory_bot_rails#432 Fix: DatabaseCleaner#89
benoittgt
added a commit
to benoittgt/database_cleaner-active_record
that referenced
this issue
Nov 23, 2023
This is well known issue. We should prefer to code that reference active record only when it's already lazy loaded. It can break other gems initializing process Related: - rails/rails#46567 - paper-trail-gem/paper_trail@fc6c5f6 (inspiration) - thoughtbot/factory_bot_rails#432 Fix: DatabaseCleaner#89
casperisfine
added a commit
to casperisfine/database_cleaner-active_record
that referenced
this issue
Nov 23, 2023
Doing this cause a slew of problems with Rails loading process, causing some configurations not to be applied, etc. Fix: DatabaseCleaner#89 Fix: DatabaseCleaner#90
etagwerker
pushed a commit
that referenced
this issue
Nov 23, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I'm using
database_cleaner-active_record
together withfactory-bot-rails
in an application.The issue is documented here: thoughtbot/factory_bot_rails#426
Here it is a reproducible test case:
Error:
It is due to the fact that Database Cleaner does not use lazy hooks before using ActiveRecord. You can see a fix to the same issue with another gem here: amoeba-rb/amoeba#115
However, the fix does not appear to be so trivial with Database Cleaner, so this is why I'm opening an issue rather than submitting a PR
The text was updated successfully, but these errors were encountered: