-
Notifications
You must be signed in to change notification settings - Fork 336
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 autoloading #172
Conversation
The build seems to fail for unrelated reasons. |
I've rebased against #173 to get the build green. |
@albus522 I've been running this patch on some production apps without any problems. Anything I can do to get this merged? |
Can you hunt down when |
Ok, so |
Explicitly requiring ActiveRecord models in `lib/delayed_job_active_record.rb` may result in losing custom configurations that are set in config/initializers on Rails. Let' use Railtie and ActiveSupport.on_load to set it up so that Delayed::Backend::ActiveRecord::Job model will respect arbitrary configs.
Delay initializing of backend until all initializers have run.
The build fails for unrelated reasons. |
Delay initializing of
backend
until all initializers have run when using Rails.As mentioned in #106 (comment) initializing
ActiveRecord
after this gem is loaded prevents problems withRails.application.config.active_record.belongs_to_required_by_default
.But instead of using
on_load(:active_record)
like in #106 this use theon_load(:after_initialize)
hook.on_load(:after_initialize)
always runs but after Rails initializes so it won't cause problems with rake tasks.See: https://guides.rubyonrails.org/engines.html#configuration-hooks
require "delayed/backend/active_record"
has been removed since it's already called inDelayed::Worker.Backend=