Skip to content

Commit

Permalink
no longer need #delete_all_on_destroy
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed May 18, 2012
1 parent 80f1694 commit a1dd008
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 17 deletions.
Expand Up @@ -18,7 +18,7 @@ def define_destroy_hook
model.send(:include, Module.new {
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def destroy_associations
association(#{name.to_sym.inspect}).delete_all_on_destroy
association(#{name.to_sym.inspect}).delete_all
super
end
RUBY
Expand Down
Expand Up @@ -42,7 +42,7 @@ def define_destroy_dependency_method
def define_delete_all_dependency_method
name = self.name
mixin.redefine_method(dependency_method_name) do
association(name).delete_all_on_destroy
association(name).delete_all
end
end

Expand Down
Expand Up @@ -152,13 +152,6 @@ def delete_all
end
end

# Called when the association is declared as :dependent => :delete_all. This is
# an optimised version which avoids loading the records into memory. Not really
# for public consumption.
def delete_all_on_destroy
scoped.delete_all
end

# Destroy all the records from this association.
#
# See destroy for more info.
Expand Down
Expand Up @@ -32,10 +32,6 @@ def insert_record(record, validate = true, raise = false)
record
end

# ActiveRecord::Relation#delete_all needs to support joins before we can use a
# SQL-only implementation.
alias delete_all_on_destroy delete_all

private

def count_records
Expand Down
Expand Up @@ -54,10 +54,6 @@ def insert_record(record, validate = true, raise = false)
record
end

# ActiveRecord::Relation#delete_all needs to support joins before we can use a
# SQL-only implementation.
alias delete_all_on_destroy delete_all

private

def through_association
Expand Down

0 comments on commit a1dd008

Please sign in to comment.