diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 03:56:05 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-18 03:56:05 +0200 |
| commit | 10bd6ba5cc640f0a85a3adb3641a65ce5edf831d (patch) | |
| tree | d8d21867d62b1dd1c156c66e7b2ca446eb7936f5 /app | |
| parent | d90ba22e5eb5a7884235d062a7d1bb4f2a6bb04f (diff) | |
Give Trash a proper title on lazy construction
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/node.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index 19669ca..b5b18a1 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -75,7 +75,11 @@ class Node < ApplicationRecord | |||
| 75 | # exist for that. | 75 | # exist for that. |
| 76 | def self.trash | 76 | def self.trash |
| 77 | root.children.find_by(:slug => CccConventions::TRASH_SLUG) || | 77 | root.children.find_by(:slug => CccConventions::TRASH_SLUG) || |
| 78 | root.children.create!(:slug => CccConventions::TRASH_SLUG) | 78 | root.children.create!(:slug => CccConventions::TRASH_SLUG).tap do |node| |
| 79 | Globalize.with_locale(I18n.default_locale) do | ||
| 80 | node.draft.update!(:title => "Trash") | ||
| 81 | end | ||
| 82 | end | ||
| 79 | end | 83 | end |
| 80 | 84 | ||
| 81 | # Instance Methods | 85 | # Instance Methods |
