From 92feab9112e64b8aab280cb90d5a5fef75646e3b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 13 Feb 2012 10:29:03 +0000 Subject: [PATCH] Make sure we don't inherit old tags when parsing XML for objects --- app/models/node.rb | 4 ++++ app/models/relation.rb | 4 ++++ app/models/way.rb | 4 ++++ 3 files changed, 12 insertions(+) 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? -- 2.43.2