diff options
Diffstat (limited to 'lib/tasks/init.rake')
| -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 |
