gitlab-org--gitlab-foss/config/initializers/active_record_preloader.rb
Heinrich Lee Yu aeb67dd489 Upgrade to Rails 5.2
Updates changed method names and fixes spec failures
2019-07-12 10:15:31 +08:00

28 lines
556 B
Ruby

module ActiveRecord
module Associations
class Preloader
class NullPreloader
def self.new(klass, owners, reflection, preload_scope)
self
end
def self.run(preloader)
end
def self.preloaded_records
[]
end
end
module NoCommitPreloader
def preloader_for(reflection, owners)
return NullPreloader if owners.first.association(reflection.name).klass == ::Commit
super
end
end
prepend NoCommitPreloader
end
end
end