Use record's primary key instead of hardcoded `id`
Enable caching for records which primary key is not `id`.
This commit is contained in:
parent
1b3affafab
commit
00092387ef
|
@ -12,7 +12,7 @@ class ReactiveCachingWorker
|
||||||
end
|
end
|
||||||
return unless klass
|
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
|
end
|
||||||
# rubocop: enable CodeReuse/ActiveRecord
|
# rubocop: enable CodeReuse/ActiveRecord
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue