From 03855e790de2224519f55382e3c32118be31eeff Mon Sep 17 00:00:00 2001 From: Jason Meller Date: Tue, 21 Jan 2014 17:34:39 -0500 Subject: 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 # => # some_book.first.authors.first some_book.first.authors.second # Before # => # # => # # After # => # # => # Fixes #13783. --- activerecord/test/fixtures/companies.yml | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/fixtures/companies.yml') diff --git a/activerecord/test/fixtures/companies.yml b/activerecord/test/fixtures/companies.yml index 0766e92027..ab9d5378ad 100644 --- a/activerecord/test/fixtures/companies.yml +++ b/activerecord/test/fixtures/companies.yml @@ -57,3 +57,11 @@ 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 -- cgit v1.2.3