diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-28 14:15:51 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-28 14:16:00 -0700 |
commit | b4ff82a79177757509cefa2b103ae56d84b84f6d (patch) | |
tree | c1a066ea1bd43a6034df92605036f789892d82b9 /activerecord/lib | |
parent | e145acd6f16cd039613cb1bcadc18b31b54c91de (diff) | |
download | rails-b4ff82a79177757509cefa2b103ae56d84b84f6d.tar.gz rails-b4ff82a79177757509cefa2b103ae56d84b84f6d.tar.bz2 rails-b4ff82a79177757509cefa2b103ae56d84b84f6d.zip |
clear and disable query cache when an exception is raised from called middleware
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/query_cache.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb index e485901440..10c0dc6f2a 100644 --- a/activerecord/lib/active_record/query_cache.rb +++ b/activerecord/lib/active_record/query_cache.rb @@ -61,6 +61,12 @@ module ActiveRecord status, headers, body = @app.call(env) [status, headers, BodyProxy.new(old, body)] + rescue Exception => e + ActiveRecord::Base.connection.clear_query_cache + unless old + ActiveRecord::Base.connection.disable_query_cache! + end + raise e end end end |