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.

clear

clear() Instance Public methods Equivalent to delete_all. The difference

2015-06-20 00:00:00
delete

delete(*records) Instance Public methods Deletes the records supplied

2015-06-20 00:00:00
create!

create!(attributes = {}, &block) Instance Public methods Like create

2015-06-20 00:00:00
reset

reset() Instance Public methods Unloads the association. Returns self

2015-06-20 00:00:00
concat

concat(*records) Instance Public methods Add one or more records to the collection

2015-06-20 00:00:00
select

select(*fields, &block) Instance Public methods Works in two ways.

2015-06-20 00:00:00
last

last(*args) Instance Public methods Returns the last record, or the last n

2015-06-20 00:00:00