From b48ee28e586fd75e84e33fabfcba70c05d32a606 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 8 Sep 2009 20:06:44 +0200 Subject: lots of gui improvements for creating nodes --- lib/Update.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 lib/Update.rb (limited to 'lib') 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 @@ +module Update + + def self.find_or_create_parent + current_year = Time.now.year.to_s + + if parent = Node.find_by_unique_name("updates/#{current_year}") + parent + else + unless updates = Node.find_by_unique_name("updates") + updates = Node.root.children.create(:slug => "updates") + end + parent = updates.children.create(:slug => current_year) + parent + end + end + +end \ No newline at end of file -- cgit v1.3