+# == Schema Information
+#
+# Table name: current_nodes
+#
+# id :integer not null, primary key
+# latitude :integer not null
+# longitude :integer not null
+# changeset_id :integer not null
+# visible :boolean not null
+# timestamp :datetime not null
+# tile :integer not null
+# version :integer not null
+#
+# Indexes
+#
+# current_nodes_tile_idx (tile)
+# current_nodes_timestamp_idx (timestamp)
+#
+# Foreign Keys
+#
+# current_nodes_changeset_id_fkey (changeset_id => changesets.id)
+#
+
+class Node < ActiveRecord::Base
+ require "xml/libxml"
+
+ include GeoRecord
+ include ConsistencyValidations
+ include NotRedactable
+ include ObjectMetadata
+
+ self.table_name = "current_nodes"
+
+ belongs_to :changeset
+
+ has_many :old_nodes, -> { order(:version) }
+
+ has_many :way_nodes
+ has_many :ways, :through => :way_nodes
+
+ has_many :node_tags
+
+ has_many :old_way_nodes
+ has_many :ways_via_history, :class_name => "Way", :through => :old_way_nodes, :source => :way
+
+ has_many :containing_relation_members, :class_name => "RelationMember", :as => :member
+ has_many :containing_relations, :class_name => "Relation", :through => :containing_relation_members, :source => :relation
+
+ validates :id, :uniqueness => true, :presence => { :on => :update },
+ :numericality => { :on => :update, :integer_only => true }
+ validates :version, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :changeset_id, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :latitude, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :longitude, :presence => true,
+ :numericality => { :integer_only => true }
+ validates :timestamp, :presence => true
+ validates :changeset, :associated => true
+ validates :visible, :inclusion => [true, false]
+