diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-16 15:12:07 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-16 15:12:07 +0200 |
| commit | b701669d0d9a5d7be01f99b8e725c05c6c5d52ce (patch) | |
| tree | 010407f079df74732cb2c6a86e49b7b72699e334 /app/models | |
| parent | c769bfb1b565cafd7a386dba5cae5b6bd4d1d38b (diff) | |
Split current_unique_name in a setter and an accessor
Also clean up some instance variable assignments on the way.
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/node.rb | 7 |
1 files changed, 5 insertions, 2 deletions
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 | |||
| 268 | parent.nil? ? [slug] : parent.path_to_root.push(slug) | 268 | parent.nil? ? [slug] : parent.path_to_root.push(slug) |
| 269 | end | 269 | end |
| 270 | 270 | ||
| 271 | def computed_unique_name | ||
| 272 | path = path_to_root[1..-1].join("/") # excluding root | ||
| 273 | end | ||
| 274 | |||
| 271 | def current_unique_name | 275 | def current_unique_name |
| 272 | path = path_to_root[1..-1] # excluding root | 276 | self.unique_name = computed_unique_name |
| 273 | self.unique_name = path.join("/") | ||
| 274 | end | 277 | end |
| 275 | 278 | ||
| 276 | def update_unique_name | 279 | def update_unique_name |
