summaryrefslogtreecommitdiff
path: root/lib/Update.rb
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-09-08 20:06:44 +0200
committerhukl <contact@smyck.org>2009-09-08 20:06:44 +0200
commitb48ee28e586fd75e84e33fabfcba70c05d32a606 (patch)
tree3654bd300fa8a2a387c50b53d23c794da49762d0 /lib/Update.rb
parentb981d83e5e005817a67b11ccf92dd65bb506bcd4 (diff)
lots of gui improvements for creating nodes
Diffstat (limited to 'lib/Update.rb')
-rw-r--r--lib/Update.rb17
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 @@
1module 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
17end \ No newline at end of file