aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
index ee138236c8..724b2e6d9c 100644
--- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
@@ -102,7 +102,10 @@ module ActiveRecord
# Clears the prepared statements cache.
def clear_cache!
- @statements.values.each { |hash| !hash[:stmt].closed? && hash[:stmt].close }
+ @statements.values.map { |hash| hash[:stmt] }.each { |stmt|
+ stmt.close unless stmt.closed?
+ }
+
@statements.clear
end