diff options
author | kennyj <kennyj@gmail.com> | 2012-10-31 02:21:52 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-10-31 10:04:10 +0900 |
commit | a7c3c9025009cef98cd91ff27707f678cb8fb3c3 (patch) | |
tree | 2d3cb829b8fcbcf4cc9aba6eedb6d2757e527a66 /activerecord/lib/active_record | |
parent | 7e17b0baec4ea811c1a7e3bd491eaedf95b1feb4 (diff) | |
download | rails-a7c3c9025009cef98cd91ff27707f678cb8fb3c3.tar.gz rails-a7c3c9025009cef98cd91ff27707f678cb8fb3c3.tar.bz2 rails-a7c3c9025009cef98cd91ff27707f678cb8fb3c3.zip |
Fix #6951. Use query cache/uncache, when using not only database.yml but also DATABASE_URL.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 12 |
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 2bd8ecda20..38e18b32a4 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -5,19 +5,19 @@ module ActiveRecord module ClassMethods # Enable the query cache within the block if Active Record is configured. def cache(&block) - if ActiveRecord::Base.configurations.blank? - yield - else + if ActiveRecord::Base.connected? connection.cache(&block) + else + yield end end # Disable the query cache within the block if Active Record is configured. def uncached(&block) - if ActiveRecord::Base.configurations.blank? - yield - else + if ActiveRecord::Base.connected? connection.uncached(&block) + else + yield end end end |