+ include GeoRecord
+ include ConsistencyValidations
+ include ObjectMetadata
+
+ self.table_name = "nodes"
+ self.primary_keys = "node_id", "version"
+
+ # note this needs to be included after the table name changes, or
+ # the queries generated by Redactable will use the wrong table name.
+ include Redactable
+
+ validates :changeset, :presence => true, :associated => true
+ validates :latitude, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :longitude, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :timestamp, :presence => true
+ validates :visible, :inclusion => [true, false]
+
+ validate :validate_position
+
+ belongs_to :changeset
+ belongs_to :redaction
+ belongs_to :current_node, :class_name => "Node", :foreign_key => "node_id"
+
+ has_many :old_tags, :class_name => "OldNodeTag", :foreign_key => [:node_id, :version]