diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-12-22 15:38:58 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-12-22 15:38:58 -0700 |
commit | fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb (patch) | |
tree | 4a2adbd6be71ea374d7832fd22b5b63c6dfb31bd /activerecord/test/models | |
parent | 18ae0656f527e790bdc827fe68e3f2edd541b3a4 (diff) | |
download | rails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.tar.gz rails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.tar.bz2 rails-fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb.zip |
Don't perform statement caching for `find` when called from a scope
If there is a method defined such as `find_and_do_stuff(id)`, which then
gets called on an association, we will perform statement caching and the
parent ID will not change on subsequent calls.
Fixes #18117
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/tyre.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/models/tyre.rb b/activerecord/test/models/tyre.rb index bc3444aa7d..e50a21ca68 100644 --- a/activerecord/test/models/tyre.rb +++ b/activerecord/test/models/tyre.rb @@ -1,3 +1,11 @@ class Tyre < ActiveRecord::Base belongs_to :car + + def self.custom_find(id) + find(id) + end + + def self.custom_find_by(*args) + find_by(*args) + end end |