Class: ActiveRecord::Associations::Preloader::HasManyThrough

Inherits:
CollectionAssociation show all
Includes:
ThroughAssociation
Defined in:
lib/active_record/associations/preloader/has_many_through.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods included from ThroughAssociation

#source_reflection, #through_reflection

Methods inherited from CollectionAssociation

#add_to_target, #build, #concat, #delete, #delete_all, #destroy, #destroy_all, #empty?, #find, #find_from_target?, #ids_reader, #ids_writer, #include?, #load_target, #null_scope?, #reader, #replace, #reset, #scope, #size, #transaction, #writer

Methods inherited from Association

#aliased_table_name, #association_scope, #create, #create!, #initialize, #initialize_attributes, #interpolate, #klass, #load_target, #loaded!, #loaded?, #marshal_dump, #marshal_load, #reload, #remove_inverse_instance, #reset, #reset_scope, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

This class inherits a constructor from ActiveRecord::Associations::Association

Instance Method Details

#associated_records_by_owner(preloader) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/active_record/associations/preloader/has_many_through.rb', line 7

def associated_records_by_owner(preloader)
  records_by_owner = super

  if reflection_scope.distinct_value
    records_by_owner.each_value(&:uniq!)
  end

  records_by_owner
end