From ce9645d0092d42c7bf8781378181ffbd4ff3d088 Mon Sep 17 00:00:00 2001 From: hukl Date: Fri, 6 Feb 2009 21:48:41 +0100 Subject: added head id to node model which points to the head of the nodes pages collection. modified tests, importer etc renamed flags to tags --- app/models/node.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/models/node.rb') diff --git a/app/models/node.rb b/app/models/node.rb index 0aa28b9..a1d8af0 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -1,7 +1,8 @@ class Node < ActiveRecord::Base acts_as_nested_set - has_many :pages, :order => "revision ASC" + has_many :pages, :order => "revision ASC" + belongs_to :head, :class_name => "Page", :foreign_key => :head_id # Class methods @@ -21,7 +22,7 @@ class Node < ActiveRecord::Base if node case revision when -1 - return node.pages.last + return node.head else return node.pages.find_by_revision revision end -- cgit v1.3