+ has_many :old_ways, -> { order(:version) }
+
+ has_many :way_nodes, -> { order(:sequence_id) }
+ has_many :nodes, :through => :way_nodes
+
+ has_many :way_tags
+
+ 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 :timestamp, :presence => true
+ validates :changeset, :associated => true
+ validates :visible, :inclusion => [true, false]
+
+ scope :visible, -> { where(:visible => true) }
+ scope :invisible, -> { where(:visible => false) }
+
+ # Read in xml as text and return it's Way object representation
+ def self.from_xml(xml, create = false)
+ p = XML::Parser.string(xml)