]> git.openstreetmap.org Git - rails.git/blobdiff - lib/diff_reader.rb
Boolean correctness in migrations
[rails.git] / lib / diff_reader.rb
index eca6d438c642722912227235370b528d47eb0343..d793f63e7bfda199d1ecc73b8d7dd6e32c8aa69d 100644 (file)
@@ -99,9 +99,8 @@ class DiffReader
           # diff, so we must fix these before saving the element.
           new.fix_placeholders!(ids)
 
           # diff, so we must fix these before saving the element.
           new.fix_placeholders!(ids)
 
-          # set the initial version to zero and save (which increments it)
-          new.version = 0
-          new.save_with_history!
+          # create element given user
+          new.create_with_history(@changeset.user)
           
           # save placeholder => allocated ID map
           ids[model.to_s.downcase.to_sym][placeholder_id] = new.id
           
           # save placeholder => allocated ID map
           ids[model.to_s.downcase.to_sym][placeholder_id] = new.id
@@ -156,7 +155,7 @@ class DiffReader
 
       else
         # no other actions to choose from, so it must be the users fault!
 
       else
         # no other actions to choose from, so it must be the users fault!
-        raise "Unknown action #{action_name}, choices are create, modify, delete."
+        raise OSM::APIChangesetActionInvalid.new(action_name)
       end
     end
 
       end
     end