method
merge_preloads
v8.0.0 -
Show latest stable
- Class:
ActiveRecord::Relation::Merger
merge_preloads()private
No documentation available.
# File activerecord/lib/active_record/relation/merger.rb, line 96
def merge_preloads
return if other.preload_values.empty? && other.includes_values.empty?
if other.model == relation.model
relation.preload_values |= other.preload_values unless other.preload_values.empty?
relation.includes_values |= other.includes_values unless other.includes_values.empty?
else
reflection = relation.model.reflect_on_all_associations.find do |r|
r.class_name == other.model.name
end || return
unless other.preload_values.empty?
relation.preload! reflection.name => other.preload_values
end
unless other.includes_values.empty?
relation.includes! reflection.name => other.includes_values
end
end
end