diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-14 12:53:39 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-14 12:53:39 +0000 |
commit | 5fa8793f02b58509a90eed69e8dc3d199f89b4ad (patch) | |
tree | b00feb5e67e67c43b20c600ad7bc62dfd98243be /activerecord/lib/active_record/associations/has_many_association.rb | |
parent | 4a1ed01e9d53da87b57802cb99e3ca7956a6eef7 (diff) | |
download | rails-5fa8793f02b58509a90eed69e8dc3d199f89b4ad.tar.gz rails-5fa8793f02b58509a90eed69e8dc3d199f89b4ad.tar.bz2 rails-5fa8793f02b58509a90eed69e8dc3d199f89b4ad.zip |
DRYed up Associations#clear. Closes #1906 [Caleb]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2580 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_many_association.rb | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 2c881290aa..114f84ed5d 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -83,20 +83,6 @@ module ActiveRecord @association_class.find(*args) end end - - # Removes all records from this association. Returns +self+ so - # method calls may be chained. - def clear - if @options[:dependent] - each { |associate| associate.destroy } - elsif @options[:exclusively_dependent] - @association_class.delete_all("#{@association_class_primary_key_name} = #{@owner.quoted_id}") - else - @association_class.update_all("#{@association_class_primary_key_name} = NULL", "#{@association_class_primary_key_name} = #{@owner.quoted_id}") - end - @target = [] - self - end protected def find_target |