aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2009-05-18 20:01:06 -0300
committerEmilio Tagua <miloops@gmail.com>2009-05-18 20:01:06 -0300
commit1cc44599397e061901cd59233397129625839a60 (patch)
tree235108ce6a9d270bdfe3264a8f5f5a7c99c3ae5c /activerecord/lib/active_record/associations/has_many_through_association.rb
parent3db44e938fc6b5a5d272c4df4cf06dd6b5715782 (diff)
parentee5520a0a5ea83843ce88f6b9550e3c36b8cdd49 (diff)
downloadrails-1cc44599397e061901cd59233397129625839a60.tar.gz
rails-1cc44599397e061901cd59233397129625839a60.tar.bz2
rails-1cc44599397e061901cd59233397129625839a60.zip
Merge commit 'rails/master'
Conflicts: activerecord/lib/active_record.rb Updated: Arel submodule
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 2dca84b911..e8dbae9011 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -17,6 +17,13 @@ module ActiveRecord
end
end
+ def destroy(*records)
+ transaction do
+ delete_records(flatten_deeper(records))
+ super
+ end
+ end
+
# Returns the size of the collection by executing a SELECT COUNT(*) query if the collection hasn't been loaded and
# calling collection.size if it has. If it's more likely than not that the collection does have a size larger than zero,
# and you need to fetch that collection afterwards, it'll take one fewer SELECT query if you use #length.