class OldNode < ActiveRecord::Base
include GeoRecord
include ConsistencyValidations
+ include Redactable
- set_table_name 'nodes'
- set_primary_keys :node_id, :version
+ self.table_name = "nodes"
+ self.primary_keys = "node_id", "version"
validates_presence_of :changeset_id, :timestamp
validates_inclusion_of :visible, :in => [ true, false ]
validates_associated :changeset
belongs_to :changeset
-
+ belongs_to :redaction
+ belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id"
+
def validate_position
errors.add(:base, "Node is not in the world") unless in_world?
end
def containing_relation_members
return []
end
+
+ # check whether this element is the latest version - that is,
+ # has the same version as its "current" counterpart.
+ def is_latest_version?
+ current_node.version == self.version
+ end
end