]> git.openstreetmap.org Git - rails.git/commitdiff
Make sure we don't inherit old tags when parsing XML for objects
authorTom Hughes <tom@compton.nu>
Mon, 13 Feb 2012 10:29:03 +0000 (10:29 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 15 Feb 2012 17:48:17 +0000 (17:48 +0000)
app/models/node.rb
app/models/relation.rb
app/models/way.rb

index 96d927b2c9144f8e915111990d16ad8834e15da4..53787245916d5c60bca1e16060e17cd0183791e2 100644 (file)
@@ -106,6 +106,10 @@ class Node < ActiveRecord::Base
     # and set manually before the actual delete
     node.visible = true
 
+    # Start with no tags
+    node.tags = Hash.new
+
+    # Add in any tags from the XML
     pt.find('tag').each do |tag|
       raise OSM::APIBadXMLError.new("node", pt, "tag is missing key") if tag['k'].nil?
       raise OSM::APIBadXMLError.new("node", pt, "tag is missing value") if tag['v'].nil?
index 908651b646da768af2b4cff8d521220bb59ff735..21ee058d8ac80e26f6969c6d7c5b49052e9075f5 100644 (file)
@@ -66,6 +66,10 @@ class Relation < ActiveRecord::Base
     # and manually set to false before the actual delete.
     relation.visible = true
 
+    # Start with no tags
+    relation.tags = Hash.new
+
+    # Add in any tags from the XML
     pt.find('tag').each do |tag|
       raise OSM::APIBadXMLError.new("relation", pt, "tag is missing key") if tag['k'].nil?
       raise OSM::APIBadXMLError.new("relation", pt, "tag is missing value") if tag['v'].nil?
index f1c46abf327cf6d634d426b62b6b3721f118d16d..adf8b928fa7a75fe8100455d7b51373e515bee7c 100644 (file)
@@ -64,6 +64,10 @@ class Way < ActiveRecord::Base
     # and manually set to false before the actual delete.
     way.visible = true
 
+    # Start with no tags
+    way.tags = Hash.new
+
+    # Add in any tags from the XML
     pt.find('tag').each do |tag|
       raise OSM::APIBadXMLError.new("way", pt, "tag is missing key") if tag['k'].nil?
       raise OSM::APIBadXMLError.new("way", pt, "tag is missing value") if tag['v'].nil?