From 19f4ca26af1ee0d42c5289935e0a5103535ecc92 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Fri, 20 Jun 2008 19:55:18 +0000 Subject: [PATCH] ActionItem466: break the loop if no ids remain --- lib/acts_as_filesystem.rb | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/lib/acts_as_filesystem.rb b/lib/acts_as_filesystem.rb index 8eb2bfb..073c113 100644 --- a/lib/acts_as_filesystem.rb +++ b/lib/acts_as_filesystem.rb @@ -165,6 +165,7 @@ module ActsAsFileSystem while !current_level.empty? result += current_level ids = current_level.select {|item| item.children_count > 0}.map(&:id) + break if ids.empty? current_level = self.class.find(:all, :conditions => { :parent_id => ids}) end block ||= (lambda { |x| x }) -- libgit2 0.21.2