From 13a86c785863c606974b62345e9a9ade1310b765 Mon Sep 17 00:00:00 2001
From: Alexander Olofsson <alexander.olofsson@liu.se>
Date: Wed, 20 Sep 2023 09:58:33 +0200
Subject: [PATCH] Support checking individual model attribute status

---
 lib/liudesk_cmdb/model.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/liudesk_cmdb/model.rb b/lib/liudesk_cmdb/model.rb
index b4e0c3d..98eb3db 100644
--- a/lib/liudesk_cmdb/model.rb
+++ b/lib/liudesk_cmdb/model.rb
@@ -261,7 +261,9 @@ module LiudeskCMDB
       @data.merge!(attrs.select { |k, _| self.class.fields.key? k })
     end
 
-    def changed?
+    def changed?(key = nil)
+      return @data[key] != @old_data[key] if key
+
       @data != @old_data
     end
 
-- 
GitLab