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

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#owner, #reflection, #target

Instance Method Summary collapse

Methods included from ThroughAssociation

#source_reflection, #through_reflection

Methods inherited from CollectionAssociation

#add_to_target, #any?, #build, #concat, #count, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #distinct, #empty?, #find, #first, #ids_reader, #ids_writer, #include?, #last, #length, #load_target, #many?, #null_scope?, #reader, #replace, #reset, #scope, #select, #size, #transaction, #writer

Methods inherited from Association

#aliased_table_name, #association_scope, #initialize, #initialize_attributes, #interpolate, #klass, #load_target, #loaded!, #loaded?, #marshal_dump, #marshal_load, #reload, #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_ownerObject



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

def associated_records_by_owner
  records_by_owner = super

  if reflection_scope.distinct_value
    records_by_owner.each_value { |records| records.uniq! }
  end

  records_by_owner
end