From 18ee41ecadd4a44981bd77ff69efeef04dedb32a Mon Sep 17 00:00:00 2001 From: JPN Date: Fri, 11 Jul 2014 13:41:29 -0400 Subject: [PATCH] Update update_index.rb Handles case if object no longer exists. --- lib/tire_async_index/workers/update_index.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tire_async_index/workers/update_index.rb b/lib/tire_async_index/workers/update_index.rb index 75a7cb4..2e80b5b 100644 --- a/lib/tire_async_index/workers/update_index.rb +++ b/lib/tire_async_index/workers/update_index.rb @@ -17,10 +17,12 @@ def process(action_type, class_name, id) case action_type.to_sym when :update - object = klass.send(get_finder_method(klass), id) - - if object.present? && object.respond_to?(:tire) - object.tire.update_index + begin + object = klass.send(get_finder_method(klass), id) + if object.present? && object.respond_to?(:tire) + object.tire.update_index + end + rescue => e end when :delete