-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made
Delayed::Backend::ActiveRecord::Job
class load lazily
In Rails, classes like `ActiveRecord::Base` are designed to be loaded lazily. If a gem eagerly loads classes when required, as this gem did, it can cause issues where configurations written in `config/initializers/*.rb` for ActiveRecord are not applied properly. To avoid this, the `ActiveSupport.on_load(:active_record) do ... end` block is used to delay loading the `ActiveRecord::Base` class and `Delayed::Backend::ActiveRecord::Job` class until after Rails has fully initialized. In this commit, I wrapped the existing `Delayed::Backend::ActiveRecord::Job` class definition in a block to minimize changes. However, it might be better to separate `Delayed::Backend::ActiveRecord::Configuration` into a dedicated file for easier management.
- Loading branch information
Showing
1 changed file
with
156 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters