Commit 19f4ca26af1ee0d42c5289935e0a5103535ecc92

Authored by AntonioTerceiro
1 parent 31686d8c

ActionItem466: break the loop if no ids remain


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2062 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 1 additions and 0 deletions   Show diff stats
lib/acts_as_filesystem.rb
... ... @@ -165,6 +165,7 @@ module ActsAsFileSystem
165 165 while !current_level.empty?
166 166 result += current_level
167 167 ids = current_level.select {|item| item.children_count > 0}.map(&:id)
  168 + break if ids.empty?
168 169 current_level = self.class.find(:all, :conditions => { :parent_id => ids})
169 170 end
170 171 block ||= (lambda { |x| x })
... ...