Skip to content

Commit

Permalink
Get rid of extra_conditions param from configure_dependency_for_has_m…
Browse files Browse the repository at this point in the history
…any. 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.
  • Loading branch information
jonleighton committed Dec 31, 2010
1 parent 6db9085 commit f7a15d0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions activerecord/lib/active_record/associations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1612,11 +1612,7 @@ def add_touch_callbacks(reflection, touch_attribute)
# - 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}"

Expand All @@ -1636,10 +1632,8 @@ class << o
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
Expand Down

0 comments on commit f7a15d0

Please sign in to comment.