diff options
author | Jason Meller <jason.meller@mandiant.com> | 2014-01-21 17:34:39 -0500 |
---|---|---|
committer | Jason Meller <jason.meller@mandiant.com> | 2014-01-21 19:35:27 -0500 |
commit | 03855e790de2224519f55382e3c32118be31eeff (patch) | |
tree | 66e881ca9c3d960058edaea67d1bbbc5d60b3d92 /activerecord/lib/active_record/relation/calculations.rb | |
parent | 9383de42a2cf23cc53052cec2f736864c1c562a1 (diff) | |
download | rails-03855e790de2224519f55382e3c32118be31eeff.tar.gz rails-03855e790de2224519f55382e3c32118be31eeff.tar.bz2 rails-03855e790de2224519f55382e3c32118be31eeff.zip |
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.
Diffstat (limited to 'activerecord/lib/active_record/relation/calculations.rb')
0 files changed, 0 insertions, 0 deletions