X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/c0b4c1b9059890e1fb683a9822b966d4efd2698c..8fb97a3337a8dbf688edc78dc37862c8e02d8cd9:/app/models/node.rb diff --git a/app/models/node.rb b/app/models/node.rb index ce2bd5c74..d3e0a7e8d 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -64,8 +64,7 @@ class Node < ActiveRecord::Base # Read in xml as text and return it's Node object representation def self.from_xml(xml, create=false) begin - p = XML::Parser.new - p.string = xml + p = XML::Parser.string(xml) doc = p.parse doc.find('//osm/node').each do |pt| @@ -83,6 +82,7 @@ class Node < ActiveRecord::Base raise OSM::APIBadXMLError.new("node", pt, "lon missing") if pt['lon'].nil? node.lat = pt['lat'].to_f node.lon = pt['lon'].to_f + raise OSM::APIBadXMLError.new("node", pt, "changeset id missing") if pt['changeset'].nil? node.changeset_id = pt['changeset'].to_i raise OSM::APIBadUserInput.new("The node is outside this world") unless node.in_world? @@ -99,15 +99,10 @@ class Node < ActiveRecord::Base # visible if it says it is, or as the default if the attribute # is missing. - node.visible = pt['visible'].nil? or pt['visible'] == 'true' + # Don't need to set the visibility, when it is set explicitly in the create/update/delete + #node.visible = pt['visible'].nil? or pt['visible'] == 'true' - if create - node.timestamp = Time.now - else - if pt['timestamp'] - node.timestamp = Time.parse(pt['timestamp']) - end - end + # We don't care about the time, as it is explicitly set on create/update/delete tags = []