From: Tom Hughes Date: Mon, 13 Feb 2012 10:29:03 +0000 (+0000) Subject: Make sure we don't inherit old tags when parsing XML for objects X-Git-Tag: live~5838 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/92feab9112e64b8aab280cb90d5a5fef75646e3b?ds=sidebyside Make sure we don't inherit old tags when parsing XML for objects --- diff --git a/app/models/node.rb b/app/models/node.rb index 96d927b2c..537872459 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -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? diff --git a/app/models/relation.rb b/app/models/relation.rb index 908651b64..21ee058d8 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -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? diff --git a/app/models/way.rb b/app/models/way.rb index f1c46abf3..adf8b928f 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -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?