instance method
proxy_association
Ruby on Rails 8.1.2
Since v4.0.13Signature
proxy_association()
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.
Source
# File activerecord/lib/active_record/associations/collection_proxy.rb, line 944
def proxy_association
@association
end
Defined in activerecord/lib/active_record/associations/collection_proxy.rb line 944
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Associations::CollectionProxy