summaryrefslogtreecommitdiff
path: root/lib/tasks
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-08-08 01:34:32 +0200
committererdgeist <erdgeist@erdgeist.org>2026-08-08 01:34:32 +0200
commit13010fd68c1f505861e1583556570c6f25d3883a (patch)
treeecb74e4760fadcab0abac95921d7c618a72383ff /lib/tasks
parent65a182112c52e9ba512bf172e1f2cdaadae9a7a5 (diff)
Fix the bootstrap task for the root node
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/init.rake6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/tasks/init.rake b/lib/tasks/init.rake
index 7e3d8dcc..16575345 100644
--- a/lib/tasks/init.rake
+++ b/lib/tasks/init.rake
@@ -27,10 +27,14 @@ namespace :cccms do
27 end 27 end
28 28
29 node = parent ? parent.children.create!(:slug => slug) : Node.create! 29 node = parent ? parent.children.create!(:slug => slug) : Node.create!
30 if parent.nil?
31 node.reload
32 node.update_column(:draft_id, node.pages.first.id) if node.draft_id.nil?
33 end
30 Globalize.with_locale(I18n.default_locale) do 34 Globalize.with_locale(I18n.default_locale) do
31 node.draft.update!(:title => title, :body => body.to_s) 35 node.draft.update!(:title => title, :body => body.to_s)
32 end 36 end
33 node.publish_draft! 37 node.publish_draft! if parent
34 puts format(" %-14s created (%d)", slug || "root", node.id) 38 puts format(" %-14s created (%d)", slug || "root", node.id)
35 node 39 node
36 end 40 end