From 13a0362e6d6bd1279ecbb4bb8c995932a0df9acd Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Mon, 7 Oct 2024 17:56:42 -0700 Subject: [PATCH] Use PetState#updated_at for the supported pose cache key, not latest ID This is because labeling poses with the Support tools *should* invalidate the `PetState.all_supported_poses` cache! But the previous cache key would only invalidate when a new pet state is *added*, not when one is *edited*. --- app/models/pet_state.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pet_state.rb b/app/models/pet_state.rb index 52dffdfd..293326d9 100644 --- a/app/models/pet_state.rb +++ b/app/models/pet_state.rb @@ -211,7 +211,7 @@ class PetState < ApplicationRecord end def self.last_updated_key - PetState.maximum(:id) + PetState.maximum(:updated_at) end def self.all_supported_poses