aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/alias_tracker.rb
diff options
context:
space:
mode:
authorJohn Hawthorn <john@stembolt.com>2017-06-20 17:35:13 -0700
committerJohn Hawthorn <john@stembolt.com>2017-06-20 17:40:08 -0700
commitc7f669af6f1d8e9053a586c97584702971e1906c (patch)
treedb0526246e0c33a617d8dcf106a88ffe07efa2de /activerecord/lib/active_record/associations/alias_tracker.rb
parent0787727cd65d820df78c9cd71ac9f145c9834762 (diff)
downloadrails-c7f669af6f1d8e9053a586c97584702971e1906c.tar.gz
rails-c7f669af6f1d8e9053a586c97584702971e1906c.tar.bz2
rails-c7f669af6f1d8e9053a586c97584702971e1906c.zip
Clear offset cache on CollectionProxy reset/reload
The `@offsets` cache is used by FinderMethods to cache records found by find_nth. This cache is cleared in AR::Relation#reset, but not in CollectionProxy#reset or CollectionProxy#reload. Because of this, since #29098, calling #first/#find_nth/etc after calling #reload or #reset on an association could return a stale record. This is an issue both when the full association target is loaded and when the item is loaded in #find_nth. This commit solves the problem by clearing the `@offsets` cache in CollectionProxy#reset and CollectionProxy#reload.
Diffstat (limited to 'activerecord/lib/active_record/associations/alias_tracker.rb')
0 files changed, 0 insertions, 0 deletions