class ActiveRecord::Associations::CollectionProxy

def build(attributes = {}, &block)

person.pets.count # => 0 # count from database
person.pets.size # => 5 # size of the collection

# ]
# #
# #,
# #,
# => [
person.pets.build([{name: 'Spook'}, {name: 'Choo-Choo'}, {name: 'Brain'}])

# => #
person.pets.build(name: 'Fancy-Fancy')

# => #
person.pets.build

end
has_many :pets
class Person

with the new objects.
You can pass an array of attributes hashes, this will return an array
with +attributes+ and linked to this object, but have not yet been saved.
Returns a new object of the collection type that has been instantiated
def build(attributes = {}, &block)
  @association.build(attributes, &block)
end