Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(destroy): prevent UnknownAttributeError in DestroyJob rescue (#1852)

sentry[bot]1f7970010aff
diff --git a/app/jobs/destroy_job.rb b/app/jobs/destroy_job.rb
index 8b5622423b..ba937e61f2 100644
--- a/app/jobs/destroy_job.rb
+++ b/app/jobs/destroy_job.rb
@@ -5,6 +5,6 @@ class DestroyJob < ApplicationJob
def perform(model)
model.destroy
rescue => e
- model.update!(scheduled_for_deletion: false) # Let's the user try again by resetting the state
+ model.update!(scheduled_for_deletion: false) if model.respond_to?(:scheduled_for_deletion) # Let's the user try again by resetting the state
end
end
diff --git a/app/models/sync.rb b/app/models/sync.rb
index cc09b9ffd0..e2ec1f28a2 100644
--- a/app/models/sync.rb
+++ b/app/models/sync.rb
@@ -250,6 +250,8 @@ class Sync < ApplicationRecord
end
def update_family_sync_timestamp
+ return unless family.persisted?
+
family.touch(:latest_sync_activity_at)
end