From 7adc4f20cc78f1150640bdc0a60832b3752244dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Fri, 6 Jul 2012 07:07:46 -0700 Subject: Merge pull request #6985 from sidonath/disable-query-cache-for-locks Disable query cache for lock queries Conflicts: activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb --- .../active_record/connection_adapters/abstract/query_cache.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index 06e4c7a6e0..6b6f92608b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -56,7 +56,7 @@ module ActiveRecord end def select_all(arel, name = nil, binds = []) - if @query_cache_enabled + if @query_cache_enabled && !locked?(arel) sql = to_sql(arel, binds) cache_sql(sql, binds) { super(sql, name, binds) } else @@ -77,6 +77,14 @@ module ActiveRecord result.collect { |row| row.dup } end + + def locked?(arel) + if arel.respond_to?(:locked) + arel.locked + else + false + end + end end end end -- cgit v1.2.3