From 07f6c276784c90c2d395b54d5398b4f2ed89cad5 Mon Sep 17 00:00:00 2001 From: Brendon Muir Date: Fri, 2 Aug 2024 13:28:27 +1200 Subject: [PATCH] Simplify composite primary_key_condition --- lib/acts_as_list/active_record/acts/list.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/acts_as_list/active_record/acts/list.rb b/lib/acts_as_list/active_record/acts/list.rb index 83912319..e2a17a87 100644 --- a/lib/acts_as_list/active_record/acts/list.rb +++ b/lib/acts_as_list/active_record/acts/list.rb @@ -481,9 +481,8 @@ def active_record_version_is?(version_requirement) requirement.satisfied_by?(version) end - def primary_key_condition(id = nil) - primary_keys = Array.wrap(self.class.primary_key) - id ? primary_keys.zip(Array.wrap(id)).to_h : slice(*primary_keys) + def primary_key_condition(id = self.id) + { self.class.primary_key => [id] } end end