diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-20 15:05:48 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2005-10-20 15:05:48 +0000 |
commit | 5f0b9369cc857ef007a9b0f573b63225e342e4fd (patch) | |
tree | 73f1ec0d8680d9ba38fe7095fe89a1e4225a3add /activerecord/lib/active_record/associations | |
parent | 7219e82fe600ff1268b9a89efc7a289ac0108592 (diff) | |
download | rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.tar.gz rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.tar.bz2 rails-5f0b9369cc857ef007a9b0f573b63225e342e4fd.zip |
Fix Associations#clear for not-yet-loaded associations (Patrick Lenz)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2695 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index ced734cfcd..164d11b2d1 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -59,7 +59,7 @@ module ActiveRecord # Removes all records from this association. Returns +self+ so method calls may be chained. def clear - return self if empty? # forces load_target if hasn't happened already + return self if length.zero? # forces load_target if hasn't happened already if @options[:exclusively_dependent] destroy_all else |