]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
Whitespace fixes for oauth_clients erb files
[rails.git] / app / models / way.rb
index d6f0011d9c7d61b4ba0609a736b759e1e3dc6197..6573b9805ecc449aac0b365e5a9a31798b86f2c2 100644 (file)
@@ -127,7 +127,7 @@ class Way < ActiveRecord::Base
         ordered_nodes[nd.sequence_id] = nd.node_id.to_s if visible_nodes[nd.node_id]
       else
         # otherwise, manually go to the db to check things
-        ordered_nodes[nd.sequence_id] = nd.node_id.to_s if nd.node && nd.node.visible?
+        ordered_nodes[nd.sequence_id] = nd.node_id.to_s if nd.node&.visible?
       end
     end
 
@@ -206,7 +206,7 @@ class Way < ActiveRecord::Base
 
   def preconditions_ok?(old_nodes = [])
     return false if nds.empty?
-    raise OSM::APITooManyWayNodesError.new(id, nds.length, MAX_NUMBER_OF_WAY_NODES) if nds.length > MAX_NUMBER_OF_WAY_NODES
+    raise OSM::APITooManyWayNodesError.new(id, nds.length, Settings.max_number_of_way_nodes) if nds.length > Settings.max_number_of_way_nodes
 
     # check only the new nodes, for efficiency - old nodes having been checked last time and can't
     # be deleted when they're in-use.
@@ -254,7 +254,7 @@ class Way < ActiveRecord::Base
   # to IDs +id_map+.
   def fix_placeholders!(id_map, placeholder_id = nil)
     nds.map! do |node_id|
-      if node_id < 0
+      if node_id.negative?
         new_id = id_map[:node][node_id]
         raise OSM::APIBadUserInput, "Placeholder node not found for reference #{node_id} in way #{id.nil? ? placeholder_id : id}" if new_id.nil?