aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/query_cache.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-17 07:10:27 -0600
committerGitHub <noreply@github.com>2017-07-17 07:10:27 -0600
commit404eceba8c8f0951407c2508567f6abefec76e4c (patch)
treecb8c690084083b6aee4a70ad29c24c0050f88bed /activerecord/lib/active_record/query_cache.rb
parente505bc8acd4448030fd4d2f85796bdb61d45a5b1 (diff)
parentfbade51248ea48db87703ba7418badbd3ed85e36 (diff)
downloadrails-404eceba8c8f0951407c2508567f6abefec76e4c.tar.gz
rails-404eceba8c8f0951407c2508567f6abefec76e4c.tar.bz2
rails-404eceba8c8f0951407c2508567f6abefec76e4c.zip
Merge branch 'master' into make-reverse-merge-bang-order-consistent
Diffstat (limited to 'activerecord/lib/active_record/query_cache.rb')
-rw-r--r--activerecord/lib/active_record/query_cache.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb
index ec246e97bc..e4c2e1f86f 100644
--- a/activerecord/lib/active_record/query_cache.rb
+++ b/activerecord/lib/active_record/query_cache.rb
@@ -5,20 +5,20 @@ module ActiveRecord
# Enable the query cache within the block if Active Record is configured.
# If it's not, it will execute the given block.
def cache(&block)
- if connected?
- connection.cache(&block)
- else
+ if configurations.empty?
yield
+ else
+ connection.cache(&block)
end
end
# Disable the query cache within the block if Active Record is configured.
# If it's not, it will execute the given block.
def uncached(&block)
- if connected?
- connection.uncached(&block)
- else
+ if configurations.empty?
yield
+ else
+ connection.uncached(&block)
end
end
end