From 1de97a5ac6f4621f8013d6f73c6c9edfae445b70 Mon Sep 17 00:00:00 2001 From: hukl Date: Sun, 15 Nov 2009 14:31:52 +0100 Subject: removed date and author from the standard template and introduced a dedicated update template which will get auto assigned if a node is created under updates// Added tests and convenient method --- app/models/node.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 7e64fdd..e9d935a 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -123,7 +123,7 @@ class Node < ActiveRecord::Base # returns an array with all parts of a unique_name rather than a string def unique_path - unique_name.split("/") rescue unique_name + unique_name.split("/") rescue [unique_name] end # returns array with pages up to root excluding root @@ -165,6 +165,10 @@ class Node < ActiveRecord::Base head_id end + def update? + unique_path.length == 3 && unique_path[0] == "updates" + end + # Returns immutable node id for all new nodes so that the atom feed entry ids # stay the same eventhough the slug or positions changes. # Can be removed after a year or so ;) -- cgit v1.3