]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
rails API support for history of node/segment/way + various bugfixes and cleanups
[rails.git] / app / models / way.rb
index 0c53e5e87c08ce090b7a05561a001ea54c9705c6..43bd4d8c394dae334a1016a9dbb1cc5a9bca4e0b 100644 (file)
@@ -6,6 +6,8 @@ class Way < ActiveRecord::Base
   has_many :way_segments, :foreign_key => 'id'
   has_many :way_tags, :foreign_key => 'id'
 
+  has_many :old_ways, :foreign_key => :id
+
   set_table_name 'current_ways'
 
   def self.from_xml(xml, create=false)
@@ -16,7 +18,7 @@ class Way < ActiveRecord::Base
     way = Way.new
 
     doc.find('//osm/way').each do |pt|
-      unless create and pt['id'] == '0'
+      if !create and pt['id'] != '0'
         way.id = pt['id'].to_i
       end