Make sure we don't inherit old tags when parsing XML for objects

This commit is contained in:
Tom Hughes 2012-02-13 10:29:03 +00:00
parent 5a8c4faf3e
commit 92feab9112
3 changed files with 12 additions and 0 deletions

View 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?

View 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?

View 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?