From 5f0b9369cc857ef007a9b0f573b63225e342e4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Thu, 20 Oct 2005 15:05:48 +0000 Subject: 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 --- activerecord/lib/active_record/associations/association_collection.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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 -- cgit v1.2.3