Method: ActiveRecord::Associations::CollectionAssociation#reader

Defined in:
activerecord/lib/active_record/associations/collection_association.rb

#readerObject

Implements the reader method, e.g. foo.items for Foo.has_many :items



34
35
36
37
38
39
40
41
42
43
# File 'activerecord/lib/active_record/associations/collection_association.rb', line 34

def reader
  ensure_klass_exists!

  if stale_target?
    reload
  end

  @proxy ||= CollectionProxy.create(klass, self)
  @proxy.reset_scope
end