]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way.rb
the user id may be negative, so that osmosis can create changesets for users that...
[rails.git] / app / models / old_way.rb
index f297cfc1ac01ac3800436817dd59c614a011aaf5..da9cf0697104ecea39d12db601d17f26e1be8cec 100644 (file)
@@ -1,8 +1,12 @@
 class OldWay < ActiveRecord::Base
+  include ConsistencyValidations
+  
   set_table_name 'ways'
 
   belongs_to :changeset
 
+  validates_associated :changeset
+  
   def self.from_way(way)
     old_way = OldWay.new
     old_way.visible = way.visible
@@ -94,8 +98,12 @@ class OldWay < ActiveRecord::Base
     el1['id'] = self.id.to_s
     el1['visible'] = self.visible.to_s
     el1['timestamp'] = self.timestamp.xmlschema
-    el1['user'] = self.user.display_name if self.user.data_public?
+    if self.changeset.user.data_public?
+      el1['user'] = self.changeset.user.display_name
+      el1['uid'] = self.changeset.user.id.to_s
+    end
     el1['version'] = self.version.to_s
+    el1['changeset'] = self.changeset.id.to_s
     
     self.old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
       e = XML::Node.new 'nd'