# in the hash to be overwritten.
raise OSM::APIDuplicateTagsError.new("relation", self.id, k) if @tags.include? k
+ # check tag size here, as we don't create a RelationTag object until
+ # just before we save...
+ raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a key, '#{k}'.") if k.length > 255
+ raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a value, '#{k}'='#{v}'.") if v.length > 255
+
@tags[k] = v
end
# use reflection to look up the appropriate class
model = Kernel.const_get(m[0].capitalize)
# get the element with that ID
- element = model.find(m[1])
+ element = model.find(:first, :conditions =>["id = ?", m[1]])
# 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
end
return true
- rescue
- return false
end
# Temporary method to match interface to nodes