- check_consistency(self, new_relation, user)
- unless new_relation.preconditions_ok?
- raise OSM::APIPreconditionFailedError.new("Cannot update relation #{self.id}: data or member data is invalid.")
+ Relation.transaction do
+ self.lock!
+ check_consistency(self, new_relation, user)
+ unless new_relation.preconditions_ok?(self.members)
+ raise OSM::APIPreconditionFailedError.new("Cannot update relation #{self.id}: data or member data is invalid.")
+ end
+ self.changeset_id = new_relation.changeset_id
+ self.changeset = new_relation.changeset
+ self.tags = new_relation.tags
+ self.members = new_relation.members
+ self.visible = true
+ save_with_history!