diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-18 13:43:44 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-18 13:43:44 -0700 |
commit | 3e2f0800e33cc056d344a45557815b19463ab416 (patch) | |
tree | 617b18720b5ce1beda64c478845538756509cb2c /activerecord/lib/active_record/associations/has_many_through_association.rb | |
parent | 87adecfef59577be17a9731245cb201ecb1b477f (diff) | |
parent | cef76c8af4705dc60f85a721e3a14adb99418d33 (diff) | |
download | rails-3e2f0800e33cc056d344a45557815b19463ab416.tar.gz rails-3e2f0800e33cc056d344a45557815b19463ab416.tar.bz2 rails-3e2f0800e33cc056d344a45557815b19463ab416.zip |
Merge branch 'master' of git@github.com:rails/rails
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.rb | 7 |
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. |