]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
now you will actually save the changeset on updating ways. Showing the changeset...
[rails.git] / app / models / way.rb
index 05b412b299f888bfab09026bed4b89d0414c3cb4..f26d7658b14589eb0b81187c2cb42882db37b9a2 100644 (file)
@@ -1,5 +1,7 @@
 class Way < ActiveRecord::Base
   require 'xml/libxml'
+  
+  include ConsistencyValidations
 
   set_table_name 'current_ways'
 
@@ -210,13 +212,23 @@ class Way < ActiveRecord::Base
     if !new_way.preconditions_ok?
       raise OSM::APIPreconditionFailedError.new
     end
-    self.changeset_id = changeset_id
+    self.changeset_id = new_way.changeset_id
     self.tags = new_way.tags
     self.nds = new_way.nds
     self.visible = true
     save_with_history!
   end
 
+  def create_with_history(user)
+    check_create_consistency(self, user)
+    if !self.preconditions_ok?
+      raise OSM::APIPreconditionFailedError.new
+    end
+    self.version = 0
+    self.visible = true
+    save_with_history!
+  end
+
   def preconditions_ok?
     return false if self.nds.empty?
     self.nds.each do |n|