summaryrefslogtreecommitdiff
path: root/lib/update.rb
blob: 480bb0b4362313caa34598bcb96702f42d867072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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