From 89978f10afbad3f856e2959a811bed1982715408 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 5 Apr 2010 12:15:08 -0700 Subject: moves Object#singleton_class to Kernel#singleton_class to match Ruby also there, same for #class_eval to simplify, and adds coverage for class_eval --- activerecord/lib/active_record/base.rb | 2 +- activerecord/lib/active_record/migration.rb | 2 +- activerecord/lib/active_record/named_scope.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5f741c6ae7..f0b107255c 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -11,7 +11,7 @@ require 'active_support/core_ext/hash/deep_merge' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/string/behavior' -require 'active_support/core_ext/object/singleton_class' +require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/duplicable' require 'active_support/core_ext/object/blank' diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index d4cda927ad..c163fb982a 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -1,4 +1,4 @@ -require 'active_support/core_ext/object/singleton_class' +require 'active_support/core_ext/kernel/singleton_class' module ActiveRecord # Exception that can be raised to stop migrations from going backwards. diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index 632322b517..aeed52e72a 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -1,6 +1,6 @@ require 'active_support/core_ext/array' require 'active_support/core_ext/hash/except' -require 'active_support/core_ext/object/singleton_class' +require 'active_support/core_ext/kernel/singleton_class' require 'active_support/core_ext/object/blank' module ActiveRecord -- cgit v1.2.3 From 1f7b4447a9030ccec542ecaa1e5e11e0d4622a84 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 5 Apr 2010 21:54:39 +0100 Subject: Memoize association.named_scope calls --- activerecord/lib/active_record/associations/association_collection.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 6eda70d0ce..5ecdf1ac8d 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -405,6 +405,9 @@ module ActiveRecord else super end + elsif @reflection.klass.scopes[method] + @_scopes ||= {} + @_scopes[method] ||= with_scope(construct_scope) { @reflection.klass.send(method, *args) } else with_scope(construct_scope) do if block_given? -- cgit v1.2.3 From 4f1d0f6b7e5718d629795b94ac12616241791334 Mon Sep 17 00:00:00 2001 From: Simon Effenberg Date: Wed, 31 Mar 2010 01:24:44 +0200 Subject: remove_index now uses quote_table_name() [#4300 state:resolved] Signed-off-by: Michael Koziarski --- .../lib/active_record/connection_adapters/abstract/schema_statements.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index 86ba7d72c3..6d4ab501fa 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -291,7 +291,7 @@ module ActiveRecord # Remove the index named by_branch_party in the accounts table. # remove_index :accounts, :name => :by_branch_party def remove_index(table_name, options = {}) - execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{table_name}" + execute "DROP INDEX #{quote_column_name(index_name(table_name, options))} ON #{quote_table_name(table_name)}" end def index_name(table_name, options) #:nodoc: -- cgit v1.2.3