]> git.openstreetmap.org Git - rails.git/blob - app/models/old_node.rb
Improve handling of login/logout some more to improve the chances of
[rails.git] / app / models / old_node.rb
1 class OldNode < ActiveRecord::Base
2   set_table_name 'nodes'
3
4   belongs_to :user
5
6   def self.from_node(node)
7     old_node = OldNode.new
8     old_node.latitude = node.latitude
9     old_node.longitude = node.longitude
10     old_node.visible = node.visible
11     old_node.tags = node.tags
12     old_node.timestamp = node.timestamp
13     old_node.user_id = node.user_id
14     old_node.id = node.id
15     return old_node
16   end
17
18   def to_xml_node
19     el1 = XML::Node.new 'node'
20     el1['id'] = self.id.to_s
21     el1['lat'] = self.latitude.to_s
22     el1['lon'] = self.longitude.to_s
23     el1['user'] = self.user.display_name if self.user.data_public?
24     Node.split_tags(el1, self.tags)
25     el1['visible'] = self.visible.to_s
26     el1['timestamp'] = self.timestamp.xmlschema
27     return el1
28   end
29
30 end