diff --git a/lib/graphiti/scope.rb b/lib/graphiti/scope.rb index 0b951260..a759a715 100644 --- a/lib/graphiti/scope.rb +++ b/lib/graphiti/scope.rb @@ -92,16 +92,17 @@ def cache_key_with_version end def updated_at - updated_ats = sideload_resource_proxies.map(&:updated_at) - + updated_time = nil begin + updated_ats = sideload_resource_proxies.map(&:updated_at) updated_ats << @object.maximum(:updated_at) + updated_time = updated_ats.compact.max rescue => e - Graphiti.log("error calculating last_modified_at for #{@resource.class}") + Graphiti.log(["error calculating last_modified_at for #{@resource.class}", :red]) Graphiti.log(e) end - updated_ats.compact.max + return updated_time || Time.now end alias_method :last_modified_at, :updated_at