Use record's primary key instead of hardcoded id

Enable caching for records which primary key is not `id`.
This commit is contained in:
Peter Leitzen 2019-01-08 21:24:55 +01:00
parent 1b3affafab
commit 00092387ef
No known key found for this signature in database
GPG key ID: 97DE9D2E708A225E

View file

@ -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