From 00092387ef855dbd28a3514ed85212344a8be5ed Mon Sep 17 00:00:00 2001
From: Peter Leitzen <pleitzen@gitlab.com>
Date: Tue, 8 Jan 2019 21:24:55 +0100
Subject: Use record's primary key instead of hardcoded `id`

Enable caching for records which primary key is not `id`.
---
 app/workers/reactive_caching_worker.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'app/workers')

diff --git a/app/workers/reactive_caching_worker.rb b/app/workers/reactive_caching_worker.rb
index 96ff8cd6222..7c66ac046ea 100644
--- a/app/workers/reactive_caching_worker.rb
+++ b/app/workers/reactive_caching_worker.rb
@@ -12,7 +12,7 @@ class ReactiveCachingWorker
     end
     return unless klass
 
-    klass.find_by(id: id).try(:exclusively_update_reactive_cache!, *args)
+    klass.find_by(klass.primary_key => id).try(:exclusively_update_reactive_cache!, *args)
   end
   # rubocop: enable CodeReuse/ActiveRecord
 end
-- 
cgit v1.2.1