From 5f976b4483609fbcd32236c92459df2527c30947 Mon Sep 17 00:00:00 2001 From: hukl Date: Sat, 7 Feb 2009 15:51:29 +0100 Subject: added new helper code to create links for a given node path. --- app/models/node.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index a1d8af0..e08e228 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -33,6 +33,11 @@ class Node < ActiveRecord::Base # Instance Methods + # returns an array with all parts of a unique_name rather than a string + def unique_path + unique_name.split("/") rescue unique_name + end + # returns array with pages up to root excluding root def path_to_root parent.nil? && [slug] || parent.path_to_root.push(slug) -- cgit v1.3