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 load fixtures from linked folders 2013-08-05 16:35:49 -03:00
categories
naked
reserved_words
to_be_linked load fixtures from linked folders 2013-08-05 16:35:49 -03:00
.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 Ensure AR #second, #third, etc. finders work through associations 2014-01-21 19:35:27 -05:00
computers.yml
courses.yml
customers.yml
dashboards.yml
developers.yml
developers_projects.yml
dog_lovers.yml Update other counter caches on destroy 2013-03-20 13:43:07 -07:00
dogs.yml Update other counter caches on destroy 2013-03-20 13:43:07 -07:00
edges.yml
entrants.yml
essays.yml
faces.yml
fk_test_has_fk.yml
fk_test_has_pk.yml
friendships.yml Refactor Person/Friendship relationships to be more intuitive 2013-03-17 02:11:19 -04:00
funny_jokes.yml
interests.yml
items.yml
jobs.yml
legacy_things.yml
mateys.yml Rename "Fixtures" class to "FixtureSet" 2012-10-07 19:15:58 +02:00
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 Extend ActiveRecord::Base#cache_key to take an optional list of timestamp attributes of which the highest will be used. 2013-11-02 16:05:19 -07:00
parrots.yml
parrots_pirates.yml Rename "Fixtures" class to "FixtureSet" 2012-10-07 19:15:58 +02:00
people.yml Refactor Person/Friendship relationships to be more intuitive 2013-03-17 02:11:19 -04:00
peoples_treasures.yml Rename "Fixtures" class to "FixtureSet" 2012-10-07 19:15:58 +02:00
pets.yml has_many through obeys order on through association 2013-04-04 15:45:13 -04:00
pirates.yml
posts.yml
price_estimates.yml
products.yml
projects.yml
randomly_named_a9.yml
ratings.yml
readers.yml Prevent Relation#merge from collapsing wheres on the RHS 2013-01-27 20:34:52 +00:00
references.yml
ships.yml
speedometers.yml
sponsors.yml we should have unique sponsorable ids in the fixtures at least 2013-10-14 15:27:49 -07:00
string_key_objects.yml
subscribers.yml
subscriptions.yml
taggings.yml
tags.yml
tasks.yml Fix broken link to Fixtures documentation on guides 2013-08-29 15:44:12 -05:00
teapots.yml
topics.yml Ensure #second acts like #first AR finder 2014-01-20 16:58:18 -05:00
toys.yml has_many through obeys order on through association 2013-04-04 15:45:13 -04:00
traffic_lights.yml test case for serialize default values. 2013-03-07 17:26:35 +01:00
treasures.yml
variants.yml
vegetables.yml
vertices.yml
warehouse-things.yml
zines.yml