diff options
| author | hukl <contact@smyck.org> | 2009-09-08 20:06:44 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-09-08 20:06:44 +0200 |
| commit | b48ee28e586fd75e84e33fabfcba70c05d32a606 (patch) | |
| tree | 3654bd300fa8a2a387c50b53d23c794da49762d0 /lib | |
| parent | b981d83e5e005817a67b11ccf92dd65bb506bcd4 (diff) | |
lots of gui improvements for creating nodes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Update.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Update.rb b/lib/Update.rb new file mode 100644 index 0000000..480bb0b --- /dev/null +++ b/lib/Update.rb | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | module Update | ||
| 2 | |||
| 3 | def self.find_or_create_parent | ||
| 4 | current_year = Time.now.year.to_s | ||
| 5 | |||
| 6 | if parent = Node.find_by_unique_name("updates/#{current_year}") | ||
| 7 | parent | ||
| 8 | else | ||
| 9 | unless updates = Node.find_by_unique_name("updates") | ||
| 10 | updates = Node.root.children.create(:slug => "updates") | ||
| 11 | end | ||
| 12 | parent = updates.children.create(:slug => current_year) | ||
| 13 | parent | ||
| 14 | end | ||
| 15 | end | ||
| 16 | |||
| 17 | end \ No newline at end of file | ||
