diff options
| author | hukl <contact@smyck.org> | 2009-02-21 12:29:30 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-21 12:29:30 +0100 |
| commit | 3f0b690d8f0011dfdcc32af2626eef473f9111b5 (patch) | |
| tree | 183889c80a3e81e1227b539db60be3cb5021b4d5 /lib/update_importer.rb | |
| parent | 950387c70e78eace6e2cfbf5667ea2c7091b4c68 (diff) | |
updated the importer to set the published_at date
properly
Diffstat (limited to 'lib/update_importer.rb')
| -rw-r--r-- | lib/update_importer.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/update_importer.rb b/lib/update_importer.rb index 0aa0dcc..1fcf40e 100644 --- a/lib/update_importer.rb +++ b/lib/update_importer.rb | |||
| @@ -84,8 +84,7 @@ class UpdateImporter | |||
| 84 | page = node.pages.create!( | 84 | page = node.pages.create!( |
| 85 | :title => xhtml.elements['title'].get_text.to_s, | 85 | :title => xhtml.elements['title'].get_text.to_s, |
| 86 | :abstract => xhtml.elements['abstract'].get_text.to_s, | 86 | :abstract => xhtml.elements['abstract'].get_text.to_s, |
| 87 | :body => body, | 87 | :body => body |
| 88 | :published_at => date | ||
| 89 | ) | 88 | ) |
| 90 | else | 89 | else |
| 91 | page = node.pages.first | 90 | page = node.pages.first |
| @@ -98,9 +97,13 @@ class UpdateImporter | |||
| 98 | :body => body | 97 | :body => body |
| 99 | ) | 98 | ) |
| 100 | 99 | ||
| 101 | page.save | ||
| 102 | end | 100 | end |
| 103 | 101 | ||
| 102 | page.published_at = date.to_time | ||
| 103 | page.save! | ||
| 104 | |||
| 105 | puts page.published_at | ||
| 106 | |||
| 104 | page.tag_list.add("update") if page | 107 | page.tag_list.add("update") if page |
| 105 | 108 | ||
| 106 | if (flags = xhtml.elements['flags']) && page | 109 | if (flags = xhtml.elements['flags']) && page |
| @@ -110,7 +113,6 @@ class UpdateImporter | |||
| 110 | end | 113 | end |
| 111 | 114 | ||
| 112 | if node.head.nil? && page | 115 | if node.head.nil? && page |
| 113 | puts page.title | ||
| 114 | node.head = page | 116 | node.head = page |
| 115 | node.save! | 117 | node.save! |
| 116 | end | 118 | end |
