]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
Make the report_error function support any http status code for added flexibility.
[rails.git] / app / models / way.rb
index cbbe6ada41f540eca762b22786e6e6aa45da362f..637f41e2883580c83b3385ac7db162ead4493a24 100644 (file)
@@ -200,7 +200,7 @@ class Way < ActiveRecord::Base
   def update_from(new_way, user)
     check_consistency(self, new_way, user)
     unless new_way.preconditions_ok?
-      raise OSM::APIPreconditionFailedError("Cannot update way #{self.id}: data is invalid.")
+      raise OSM::APIPreconditionFailedError.new("Cannot update way #{self.id}: data is invalid.")
     end
 
     self.changeset_id = new_way.changeset_id
@@ -214,7 +214,7 @@ class Way < ActiveRecord::Base
   def create_with_history(user)
     check_create_consistency(self, user)
     unless self.preconditions_ok?
-      raise OSM::APIPreconditionFailedError("Cannot create way: data is invalid.")
+      raise OSM::APIPreconditionFailedError.new("Cannot create way: data is invalid.")
     end
     self.version = 0
     self.visible = true
@@ -224,7 +224,7 @@ class Way < ActiveRecord::Base
   def preconditions_ok?
     return false if self.nds.empty?
     if self.nds.length > APP_CONFIG['max_number_of_way_nodes']
-      raise OSM::APITooManyWayNodesError.new(self.nds.count, APP_CONFIG['max_number_of_way_nodes'])
+      raise OSM::APITooManyWayNodesError.new(self.nds.length, APP_CONFIG['max_number_of_way_nodes'])
     end
     self.nds.each do |n|
       node = Node.find(:first, :conditions => ["id = ?", n])