2017-05-31 12:12:21 -04:00
|
|
|
module ActiveRecord
|
|
|
|
module Associations
|
|
|
|
class Preloader
|
2019-06-25 13:54:42 -04:00
|
|
|
class NullPreloader
|
|
|
|
def self.new(klass, owners, reflection, preload_scope)
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.run(preloader)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.preloaded_records
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-05-31 12:12:21 -04:00
|
|
|
module NoCommitPreloader
|
2019-06-25 13:54:42 -04:00
|
|
|
def preloader_for(reflection, owners)
|
|
|
|
return NullPreloader if owners.first.association(reflection.name).klass == ::Commit
|
2017-05-31 12:12:21 -04:00
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
prepend NoCommitPreloader
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|