class EagerGroup::Preloader::HasManyThroughMany
Public Instance Methods
aggregate_hash()
click to toggle source
# File lib/eager_group/preloader/has_many_through_many.rb, line 10 def aggregate_hash scope = klass.joins(reflection.name).tap{|query| query.merge!(definition_scope) if definition_scope } scope.where(group_by_foreign_key => record_ids). where(polymophic_as_condition). group(group_by_foreign_key). send(definition.aggregation_function, definition.column_name) end
group_by_foreign_key()
click to toggle source
# File lib/eager_group/preloader/has_many_through_many.rb, line 6 def group_by_foreign_key "#{reflection.through_reflection.name}.#{reflection.through_reflection.foreign_key}" end