diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-12-30 20:47:31 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-12-31 20:00:44 +0000 |
commit | f7a15d0e03dc173ab5f88773a97a3bf26d7b957e (patch) | |
tree | a263998a9875904fa1b08d192497449ae69ac0cc /activerecord | |
parent | 6db908515919a22c475bec2dd0ddc157e7933f3d (diff) | |
download | rails-f7a15d0e03dc173ab5f88773a97a3bf26d7b957e.tar.gz rails-f7a15d0e03dc173ab5f88773a97a3bf26d7b957e.tar.bz2 rails-f7a15d0e03dc173ab5f88773a97a3bf26d7b957e.zip |
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.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations.rb | 12 |
1 files changed, 3 insertions, 9 deletions
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 |