proxy_association() public

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.

Show source
Register or log in to add new notes.