Skip to content
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 eager loading a Rails app with performs in an associated object #14

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/active_record/associated_object/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ class ActiveRecord::AssociatedObject::Railtie < Rails::Railtie
config.after_initialize do
ActiveRecord::AssociatedObject.include Kredis::Attributes if defined?(Kredis)
ActiveRecord::AssociatedObject.include GlobalID::Identification if defined?(GlobalID)

ActiveSupport.on_load :active_job do
require "active_job/performs"
ActiveRecord::AssociatedObject.extend ActiveJob::Performs
rescue LoadError
# We haven't bundled active_job-performs, so we're continuing without it.
end
end
end

initializer "object_association.setup" do
ActiveSupport.on_load :active_job do
require "active_job/performs"
ActiveRecord::AssociatedObject.extend ActiveJob::Performs
rescue LoadError
# We haven't bundled active_job-performs, so we're continuing without it.
end

ActiveSupport.on_load :active_record do
require "active_record/associated_object/object_association"
extend ActiveRecord::AssociatedObject::ObjectAssociation
Expand Down