From f7a15d0e03dc173ab5f88773a97a3bf26d7b957e Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 30 Dec 2010 20:47:31 +0000 Subject: Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy. --- activerecord/lib/active_record/associations.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 17889bebfd..b82651ebce 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1612,11 +1612,7 @@ module ActiveRecord # - set the foreign key to NULL if the option is set to :nullify # - do not delete the parent record if there is any child record if the # option is set to :restrict - # - # The +extra_conditions+ parameter, which is not used within the main - # Active Record codebase, is meant to allow plugins to define extra - # finder conditions. - def configure_dependency_for_has_many(reflection, extra_conditions = nil) + def configure_dependency_for_has_many(reflection) if reflection.options[:dependent] method_name = "has_many_dependent_for_#{reflection.name}" @@ -1636,10 +1632,8 @@ module ActiveRecord end end - reflection.klass.send(:with_scope, :find => { :conditions => extra_conditions }) do - # AssociationProxy#delete_all looks at the :dependent option and acts accordingly - send(reflection.name).delete_all - end + # AssociationProxy#delete_all looks at the :dependent option and acts accordingly + send(reflection.name).delete_all end when :restrict define_method(method_name) do -- cgit v1.2.3