diff options
| author | hukl <hukl@eight.local> | 2009-02-07 15:51:29 +0100 |
|---|---|---|
| committer | hukl <hukl@eight.local> | 2009-02-07 15:51:29 +0100 |
| commit | 5f976b4483609fbcd32236c92459df2527c30947 (patch) | |
| tree | 42b27fbc3c63fbb0bad0ba2eca9da516c609c692 /app/models/node.rb | |
| parent | 36a2f1f3c085dd81171cf7d8220770d4ff921ab3 (diff) | |
added new helper code to create links for a given
node path.
Diffstat (limited to 'app/models/node.rb')
| -rw-r--r-- | app/models/node.rb | 5 |
1 files changed, 5 insertions, 0 deletions
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 | |||
| 33 | 33 | ||
| 34 | # Instance Methods | 34 | # Instance Methods |
| 35 | 35 | ||
| 36 | # returns an array with all parts of a unique_name rather than a string | ||
| 37 | def unique_path | ||
| 38 | unique_name.split("/") rescue unique_name | ||
| 39 | end | ||
| 40 | |||
| 36 | # returns array with pages up to root excluding root | 41 | # returns array with pages up to root excluding root |
| 37 | def path_to_root | 42 | def path_to_root |
| 38 | parent.nil? && [slug] || parent.path_to_root.push(slug) | 43 | parent.nil? && [slug] || parent.path_to_root.push(slug) |
