From 5e1f877d6fb4f7504039444ad36ad7b964fc934e Mon Sep 17 00:00:00 2001 From: hukl Date: Wed, 7 Oct 2009 17:53:29 +0200 Subject: and add it back in --- 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