From d48add714d96695a0f5d73bd50696dc26c29c794 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sat, 28 May 2011 02:55:33 +0530 Subject: close statment only if its not closed --- activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index 8e7c936bf8..ee138236c8 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -102,7 +102,7 @@ module ActiveRecord # Clears the prepared statements cache. def clear_cache! - @statements.values.each { |hash| hash[:stmt].close } + @statements.values.each { |hash| !hash[:stmt].closed? && hash[:stmt].close } @statements.clear end -- cgit v1.2.3 From ed1a0672abb4d6e8aba3f6db7d90970f98a5f8c2 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sat, 28 May 2011 03:00:11 +0530 Subject: delegate connection and column_hash calls directly to model --- activerecord/lib/active_record/relation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d88e2693b6..e852f50d86 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -12,7 +12,7 @@ module ActiveRecord # These are explicitly delegated to improve performance (avoids method_missing) delegate :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a - delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key, :to => :klass + delegate :table_name, :quoted_table_name, :primary_key, :quoted_primary_key, :connection, :column_hash,:to => :klass attr_reader :table, :klass, :loaded attr_accessor :extensions, :default_scoped -- cgit v1.2.3