]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/relation.rb
Fix any_relations always being false
[rails.git] / app / models / relation.rb
index 42ac3d6dc337ce11633ac4a68765b621b2b51d4d..202db12daa66479f379c4aeb84e49122279b1991 100644 (file)
@@ -275,7 +275,7 @@ class Relation < ActiveRecord::Base
   def fix_placeholders!(id_map, placeholder_id = nil)
     members.map! do |type, id, role|
       old_id = id.to_i
-      if old_id < 0
+      if old_id.negative?
         new_id = id_map[type.downcase.to_sym][old_id]
         raise OSM::APIBadUserInput, "Placeholder #{type} not found for reference #{old_id} in relation #{self.id.nil? ? placeholder_id : self.id}." if new_id.nil?
 
@@ -381,7 +381,7 @@ class Relation < ActiveRecord::Base
       # reasonable on the assumption that adding or removing members doesn't
       # materially change the rest of the relation.
       any_relations =
-        changed_members.collect { |_id, type| type == "relation" }
+        changed_members.collect { |type, _id, _role| type == "Relation" }
                        .inject(false) { |acc, elem| acc || elem }
 
       update_members = if tags_changed || any_relations