diff options
| author | erdgeist <erdgeist@dyn-174.club.berlin.ccc.de> | 2009-04-09 20:13:30 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@dyn-174.club.berlin.ccc.de> | 2009-04-09 20:13:30 +0200 |
| commit | 44e1eff0155d3da825ae7f4ef9e334a8e231e909 (patch) | |
| tree | e6d21e4d0b8464ac9febb9efacc68cabe321a9c6 /app/models | |
| parent | 8c6b4dcf08268ed2971b06df40c733ba28448582 (diff) | |
| parent | acc9301696de3589a17d1543a7ab3fc1914e8ce8 (diff) | |
Merge branch 'master' of ssh://git@svn.medienhaus.udk-berlin.de/usr/local/git/cccms
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/node.rb | 2 | ||||
| -rw-r--r-- | app/models/page.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/app/models/node.rb b/app/models/node.rb index 8b7fe62..b56dff5 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -88,7 +88,7 @@ class Node < ActiveRecord::Base | |||
| 88 | 88 | ||
| 89 | # returns array with pages up to root excluding root | 89 | # returns array with pages up to root excluding root |
| 90 | def path_to_root | 90 | def path_to_root |
| 91 | parent.nil? && [slug] || parent.path_to_root.push(slug) | 91 | parent.nil? ? [slug] : parent.path_to_root.push(slug) |
| 92 | end | 92 | end |
| 93 | 93 | ||
| 94 | def update_unique_name | 94 | def update_unique_name |
diff --git a/app/models/page.rb b/app/models/page.rb index dfabecf..b2c0ff8 100644 --- a/app/models/page.rb +++ b/app/models/page.rb | |||
| @@ -13,6 +13,12 @@ class Page < ActiveRecord::Base | |||
| 13 | :conditions => ["nodes.draft_id = pages.id"] | 13 | :conditions => ["nodes.draft_id = pages.id"] |
| 14 | ) | 14 | ) |
| 15 | 15 | ||
| 16 | named_scope( | ||
| 17 | :heads, | ||
| 18 | :include => [:node, :user, :globalize_translations], | ||
| 19 | :conditions => ["nodes.head_id = pages.id"] | ||
| 20 | ) | ||
| 21 | |||
| 16 | # Mixins and Plugins | 22 | # Mixins and Plugins |
| 17 | acts_as_taggable | 23 | acts_as_taggable |
| 18 | acts_as_list :column => :revision, :scope => :node_id | 24 | acts_as_list :column => :revision, :scope => :node_id |
