class ActiveRecord::Associations::CollectionProxy

def last(limit = nil)

another_person_without.pets.last(3) # => []
another_person_without.pets.last # => nil
another_person_without.pets # => []

# ]
# #
# #,
# => [
person.pets.last(2)

person.pets.last # => #

# ]
# #
# #,
# #,
# => [
person.pets

end
has_many :pets
class Person < ActiveRecord::Base

form returns an empty array.
If the collection is empty, the first form returns +nil+, and the second
Returns the last record, or the last +n+ records, from the collection.
def last(limit = nil)
  load_target if find_from_target?
  super
end