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 | |
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')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_through_association.rb | 7 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 2 |
2 files changed, 8 insertions, 1 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. diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index e8e1746b4b..1400096ffb 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2177,7 +2177,7 @@ module ActiveRecord #:nodoc: # default_scope :order => 'last_name, first_name' # end def default_scope(options = {}) - self.default_scoping << { :find => options, :create => (options.is_a?(Hash) && options.has_key?(:conditions)) ? options[:conditions] : {} } + self.default_scoping << { :find => options, :create => options[:conditions].is_a?(Hash) ? options[:conditions] : {} } end # Test whether the given method and optional key are scoped. |