Type:
Class

Association proxies in Active Record are middlemen between the object that holds the association, known as the @owner, and the actual associated object, known as the @target. The kind of association any proxy is about is available in @reflection. That's an instance of the class ActiveRecord::Reflection::AssociationReflection.

For example, given

class Blog < ActiveRecord::Base
  has_many :posts
end

blog = Blog.first

the association proxy in blog.posts has the object in blog as @owner, the collection of its posts as @target, and the @reflection object represents a :has_many macro.

This class delegates unknown methods to @target via method_missing.

The @target object is not loaded until needed. For example,

blog.posts.count

is computed directly through SQL and does not trigger by itself the instantiation of the actual post records.

include?

include?(record) Instance Public methods Returns true if the given

2015-06-20 00:00:00
<<

<<(*records) Instance Public methods Adds one or more records

2015-06-20 00:00:00
create

create(attributes = {}, &block) Instance Public methods Returns a new object

2015-06-20 00:00:00
load_target

load_target() Instance Public methods

2015-06-20 00:00:00
uniq

uniq() Instance Public methods Alias for:

2015-06-20 00:00:00
distinct

distinct() Instance Public methods Specifies whether the records should be unique

2015-06-20 00:00:00
to_a

to_a() Instance Public methods Alias for:

2015-06-20 00:00:00
reload

reload() Instance Public methods Reloads the collection from the database. Returns

2015-06-20 00:00:00
length

length() Instance Public methods Returns the size of the collection calling

2015-06-20 00:00:00
arel

arel() Instance Public methods

2015-06-20 00:00:00