Flowdock

Collection proxies in Active Record are middlemen between an association, and its target result set.

For example, given

class Blog < ActiveRecord::Base
  has_many :posts
end

blog = Blog.first

The collection proxy returned by blog.posts is built from a :has_many association, and delegates to a collection of posts as the target.

This class delegates unknown methods to the association's relation class via a delegate cache.

The target result set 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.

Show files where this class is defined (1 file)
Register or log in to add new notes.