diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-06 07:07:46 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-07-06 18:15:31 -0300 |
commit | 7adc4f20cc78f1150640bdc0a60832b3752244dc (patch) | |
tree | 5561ae88e096c6781944e48773d5214e82341d94 /activerecord/lib/active_record/connection_adapters | |
parent | 03dcdc317de7e63632da685255ca8b7f91bf5522 (diff) | |
download | rails-7adc4f20cc78f1150640bdc0a60832b3752244dc.tar.gz rails-7adc4f20cc78f1150640bdc0a60832b3752244dc.tar.bz2 rails-7adc4f20cc78f1150640bdc0a60832b3752244dc.zip |
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
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb | 10 |
1 files changed, 9 insertions, 1 deletions
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 |