X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/30bbca0f3b05834dc9fd899e75e01b1994c0333b..ed68d524de0703685ff15f1ab574c61ec67e2c22:/app/models/relation.rb diff --git a/app/models/relation.rb b/app/models/relation.rb index b66d957b9..24b139f0d 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -218,6 +218,11 @@ class Relation < ActiveRecord::Base # 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 @@ -298,7 +303,7 @@ class Relation < ActiveRecord::Base # 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?