summaryrefslogtreecommitdiff
path: root/app/models/node.rb
diff options
context:
space:
mode:
authorhukl <contact@smyck.org>2009-11-15 14:31:52 +0100
committerhukl <contact@smyck.org>2009-11-15 14:31:52 +0100
commit1de97a5ac6f4621f8013d6f73c6c9edfae445b70 (patch)
treeee500916af41898ff2ecaf5c8567acf7cfd0f867 /app/models/node.rb
parent713f8f76e2ae1635bb938de6d8c74587d842790f (diff)
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/<year>/<slug>
Added tests and convenient method
Diffstat (limited to 'app/models/node.rb')
-rw-r--r--app/models/node.rb6
1 files changed, 5 insertions, 1 deletions
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
123 123
124 # returns an array with all parts of a unique_name rather than a string 124 # returns an array with all parts of a unique_name rather than a string
125 def unique_path 125 def unique_path
126 unique_name.split("/") rescue unique_name 126 unique_name.split("/") rescue [unique_name]
127 end 127 end
128 128
129 # returns array with pages up to root excluding root 129 # returns array with pages up to root excluding root
@@ -165,6 +165,10 @@ class Node < ActiveRecord::Base
165 head_id 165 head_id
166 end 166 end
167 167
168 def update?
169 unique_path.length == 3 && unique_path[0] == "updates"
170 end
171
168 # Returns immutable node id for all new nodes so that the atom feed entry ids 172 # Returns immutable node id for all new nodes so that the atom feed entry ids
169 # stay the same eventhough the slug or positions changes. 173 # stay the same eventhough the slug or positions changes.
170 # Can be removed after a year or so ;) 174 # Can be removed after a year or so ;)