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 179 def _eager_graph_build_associations(_, egl) 180 objects = super 181 182 master = egl.master 183 egl.records_map.each do |k, v| 184 next if k == master || v.empty? 185 186 by = opts[:graph][:table_aliases][k] 187 values = v.values 188 189 values.each do |o| 190 next unless o.is_a?(TacticalEagerLoading::InstanceMethods) && !o.retrieved_by 191 o.retrieved_by = by 192 o.retrieved_with = values 193 end 194 end 195 196 objects 197 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 201 def post_load(objects) 202 super 203 objects.each do |o| 204 next unless o.is_a?(Sequel::Model) 205 o.retrieved_by = self 206 o.retrieved_with = objects 207 end 208 end