1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test/fixtures
Jason Meller 03855e790d Ensure AR #second, #third, etc. finders work through associations
This commit fixes two regressions introduced in cafe31a078 where
newly created finder methods #second, #third, #forth, and #fifth
caused a NoMethodError error on reload associations and where we
were pulling the wrong element out of cached associations.

Examples:

  some_book.authors.reload.second

  # Before
  # => NoMethodError: undefined method 'first' for nil:NilClass

  # After
  # => #<Author id: 2, name: "Sally Second", ...>

  some_book.first.authors.first
  some_book.first.authors.second

  # Before
  # => #<Author id: 1, name: "Freddy First", ...>
  # => #<Author id: 1, name: "Freddy First", ...>

  # After
  # => #<Author id: 1, name: "Freddy First", ...>
  # => #<Author id: 2, name: "Sally Second", ...>

Fixes #13783.
2014-01-21 19:35:27 -05:00
..
admin
all
categories
naked
reserved_words
to_be_linked
.gitignore
accounts.yml
author_addresses.yml
author_favorites.yml
authors.yml
binaries.yml
books.yml
cars.yml
categories.yml
categories_ordered.yml
categories_posts.yml
categorizations.yml
clubs.yml
collections.yml
colleges.yml
comments.yml
companies.yml
computers.yml
courses.yml
customers.yml
dashboards.yml
developers.yml
developers_projects.yml
dog_lovers.yml
dogs.yml
edges.yml
entrants.yml
essays.yml
faces.yml
fk_test_has_fk.yml
fk_test_has_pk.yml
friendships.yml
funny_jokes.yml
interests.yml
items.yml
jobs.yml
legacy_things.yml
mateys.yml
member_details.yml
member_types.yml
members.yml
memberships.yml
men.yml
minimalistics.yml
minivans.yml
mixed_case_monkeys.yml
mixins.yml
movies.yml
organizations.yml
other_topics.yml
owners.yml
parrots.yml
parrots_pirates.yml
people.yml
peoples_treasures.yml
pets.yml
pirates.yml
posts.yml
price_estimates.yml
products.yml
projects.yml
randomly_named_a9.yml
ratings.yml
readers.yml
references.yml
ships.yml
speedometers.yml
sponsors.yml
string_key_objects.yml
subscribers.yml
subscriptions.yml
taggings.yml
tags.yml
tasks.yml
teapots.yml
topics.yml
toys.yml
traffic_lights.yml
treasures.yml
variants.yml
vegetables.yml
vertices.yml
warehouse-things.yml
zines.yml