From: Matt Amos Date: Thu, 14 May 2009 11:19:28 +0000 (+0000) Subject: Fixed precondition failed message which was trying to dereference nil. X-Git-Tag: live~7395 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d7badc8402876ca666236955c0012efae002e3e8?hp=add2d223a646fa108288ffdfe3619a18785febcd Fixed precondition failed message which was trying to dereference nil. --- diff --git a/app/models/relation.rb b/app/models/relation.rb index 95181ef05..2619a545a 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -307,8 +307,7 @@ class Relation < ActiveRecord::Base # and check that it is OK to use. unless element and element.visible? and element.preconditions_ok? - raise OSM::APIPreconditionFailedError.new("Relation with id #{self.id} cannot be saved due to #{m[0]} with id #{element.id}") - return false + raise OSM::APIPreconditionFailedError.new("Relation with id #{self.id} cannot be saved due to #{m[0]} with id #{m[1]}") end hash[m[1]] = true end diff --git a/test/functional/relation_controller_test.rb b/test/functional/relation_controller_test.rb index e51db0b75..bb562b24b 100644 --- a/test/functional/relation_controller_test.rb +++ b/test/functional/relation_controller_test.rb @@ -341,7 +341,7 @@ class RelationControllerTest < ActionController::TestCase # expect failure assert_response :precondition_failed, "relation upload with invalid node did not return 'precondition failed'" - assert_equal "Precondition failed: Cannot create relation: data or member data is invalid.", @response.body + assert_equal "Precondition failed: Relation with id cannot be saved due to Node with id 0", @response.body end # -------------------------------------