From fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 22 Dec 2014 15:38:58 -0700 Subject: 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 --- activerecord/lib/active_record/core.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index c2d5582f02..94d1e07069 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -131,6 +131,7 @@ module ActiveRecord return super if block_given? || primary_key.nil? || default_scopes.any? || + current_scope || columns_hash.include?(inheritance_column) || ids.first.kind_of?(Array) -- cgit v1.2.3