From b701669d0d9a5d7be01f99b8e725c05c6c5d52ce Mon Sep 17 00:00:00 2001 From: erdgeist Date: Thu, 16 Jul 2026 15:12:07 +0200 Subject: Split current_unique_name in a setter and an accessor Also clean up some instance variable assignments on the way. --- app/models/node.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 6ca607d..717f5b4 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -268,9 +268,12 @@ class Node < ApplicationRecord parent.nil? ? [slug] : parent.path_to_root.push(slug) end + def computed_unique_name + path = path_to_root[1..-1].join("/") # excluding root + end + def current_unique_name - path = path_to_root[1..-1] # excluding root - self.unique_name = path.join("/") + self.unique_name = computed_unique_name end def update_unique_name -- cgit v1.3