-
Notifications
You must be signed in to change notification settings - Fork 7
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
Minor Rails 6.1 fix, plus autoload Delayed::Job constant #2
Conversation
Needs somebody from @samandmoore and @effron to claim domain review Use the shovel operator to claim, e.g.:
|
Needs somebody from @samandmoore and @effron to claim domain review Use the shovel operator to claim, e.g.:
|
1 similar comment
Needs somebody from @samandmoore and @effron to claim domain review Use the shovel operator to claim, e.g.:
|
<<domainlgtm This seems a lil odd to me but it also seems fine. I don't have any better ideas, just ones that are weird in different ways lol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! ⚡ 🌟 🎯
This PR requires additional review because of new changes Please get another domain review from @samandmoore, or another reviewer with write access if unavailable. |
bump @samandmoore -- ended up updating version+changelog in this PR |
domainlgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! 🌮 🍟 🍕
/domain @samandmoore @effron
/no-platform
This fixes an issue I was seeing on a very slim Rails 6.1 app -- essentially,
ActiveSupport.on_load(:active_record)
was not triggering at all duringrake delayed:work
, resulting in a missing constant error. Previous versions of rails seem to loadActiveRecord::Base
during boot, but 6.1 seems to have found a way to optimize that step away.This PR moves the
delayed/job.rb
class toapp/models
and converts the gem'sRailtie
to anEngine
, allowing it to autoload files inapp/models
by convention. In cases where we are not in a Rails app (andRails::Engine
is not defined), we fall back on loading active_record manually and then running arequire_relative
of the specificjob.rb
file. I based this on other "rails-engine-optional" gems I've encountered, and confirmed that it works in anirb
console.I also removed
require 'delayed/serialization/active_record'
because it would already be loaded inside ofrequire 'delayed/yaml_ext'
. It also only applies tosyck
which dates back to Ruby 1.9, and we should consider removing support for it entirely. (It can still be installed via thesyck
gem, butpsych
has been the default for many, many years.)