X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/2063fc98f185e68bc655b79f6d75010ad2a6b9b3..67dd9e4c9d487bdb5f38a09dc0c99def4989326e:/app/models/old_node.rb diff --git a/app/models/old_node.rb b/app/models/old_node.rb index 64ae1a70c..5643a389b 100644 --- a/app/models/old_node.rb +++ b/app/models/old_node.rb @@ -1,6 +1,7 @@ class OldNode < ActiveRecord::Base include GeoRecord include ConsistencyValidations + include Redactable self.table_name = "nodes" self.primary_keys = "node_id", "version" @@ -12,7 +13,9 @@ class OldNode < ActiveRecord::Base 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 @@ -106,4 +109,10 @@ class OldNode < ActiveRecord::Base 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