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/companies.yml
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

67 lines
846 B
YAML

first_client:
id: 2
type: Client
firm_id: 1
client_of: 2
name: Summit
firm_name: 37signals
first_firm:
id: 1
type: Firm
name: 37signals
firm_id: 1
second_client:
id: 3
type: Client
firm_id: 1
client_of: 1
name: Microsoft
another_firm:
id: 4
type: Firm
name: Flamboyant Software
another_client:
id: 5
type: Client
firm_id: 4
client_of: 4
name: Ex Nihilo
a_third_client:
id: 10
type: Client
firm_id: 4
client_of: 4
name: Ex Nihilo Part Deux
rails_core:
id: 6
name: RailsCore
type: DependentFirm
leetsoft:
id: 7
name: Leetsoft
client_of: 6
jadedpixel:
id: 8
name: Jadedpixel
client_of: 6
odegy:
id: 9
name: Odegy
type: ExclusivelyDependentFirm
another_first_firm_client:
id: 11
type: Client
firm_id: 1
client_of: 1
name: Apex
firm_name: 37signals