From 5852bcb1428d47856e87b15180dc32cf397df3c7 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 9 Dec 2014 20:11:25 +0100 Subject: [PATCH] Improved memory management on many objects. --- app/models/application_model.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/application_model.rb b/app/models/application_model.rb index af3f03919..46b02da6b 100644 --- a/app/models/application_model.rb +++ b/app/models/application_model.rb @@ -550,7 +550,9 @@ reload search index with full data def self.search_index_reload return if !@search_index_support_config - self.all.order('created_at DESC').each { |item| + all_ids = self.select('id').all.order('created_at DESC') + all_ids.each { |item_with_id| + item = self.find( item_with_id.id ) item.search_index_update_backend } end