X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/013ef53c97a1d2c8319f1ac624e8325a06828366..7151fa05e4d4f73956d7f9a7ad2db1f5b956a0c0:/app/models/relation.rb diff --git a/app/models/relation.rb b/app/models/relation.rb index 58add6dd0..984732c71 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -31,6 +31,8 @@ class Relation < ActiveRecord::Base relation.id = pt['id'].to_i end + relation.version = pt['version'] + if create relation.timestamp = Time.now relation.visible = true @@ -222,6 +224,8 @@ class Relation < ActiveRecord::Base def update_from(new_relation, user) if !new_relation.preconditions_ok? raise OSM::APIPreconditionFailedError.new + elsif new_relation.version != version + raise OSM::APIVersionMismatchError.new(new_relation.version, version) else self.user_id = user.id self.tags = new_relation.tags