diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-08 01:34:32 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-08 01:34:32 +0200 |
| commit | 13010fd68c1f505861e1583556570c6f25d3883a (patch) | |
| tree | ecb74e4760fadcab0abac95921d7c618a72383ff /lib | |
| parent | 65a182112c52e9ba512bf172e1f2cdaadae9a7a5 (diff) | |
Fix the bootstrap task for the root node
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/tasks/init.rake | 6 |
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 |
