Method: ActiveRecord::Associations::CollectionProxy#proxy_association

Defined in:
activerecord/lib/active_record/associations/collection_proxy.rb

#proxy_associationObject

Returns the association object for the collection.

class Person < ActiveRecord::Base
  has_many :pets
end

person.pets.proxy_association
# => #<ActiveRecord::Associations::HasManyAssociation owner="#<Person:0x00>">

Returns the same object as person.association(:pets), allowing you to make calls like person.pets.proxy_association.owner.

See Associations::ClassMethods@Association+extensions for more.



944
945
946
# File 'activerecord/lib/active_record/associations/collection_proxy.rb', line 944

def proxy_association
  @association
end