module Sequel::Plugins::TacticalEagerLoading::DatasetMethods
Private Instance Methods
_eager_graph_build_associations(_, egl)
click to toggle source
Set the retrieved_with and retrieved_by attributes for each of the associated objects created by the eager graph loader with the appropriate class dataset and array of objects.
Calls superclass method
# File lib/sequel/plugins/tactical_eager_loading.rb 172 def _eager_graph_build_associations(_, egl) 173 objects = super 174 175 master = egl.master 176 egl.records_map.each do |k, v| 177 next if k == master || v.empty? 178 179 by = opts[:graph][:table_aliases][k] 180 values = v.values 181 182 values.each do |o| 183 next unless o.is_a?(TacticalEagerLoading::InstanceMethods) && !o.retrieved_by 184 o.retrieved_by = by 185 o.retrieved_with = values 186 end 187 end 188 189 objects 190 end
post_load(objects)
click to toggle source
Set the retrieved_with and retrieved_by attributes for each object with the current dataset and array of all objects.
Calls superclass method
# File lib/sequel/plugins/tactical_eager_loading.rb 194 def post_load(objects) 195 super 196 objects.each do |o| 197 next unless o.is_a?(Sequel::Model) 198 o.retrieved_by = self 199 o.retrieved_with = objects 200 end 201 end