When asked for ways which use a node, or relations which use some given
object, return 200 OK with an empty document if not matches are found rather than 400 Bad Request (for ways) or 404 Not Found (for relations).
This commit is contained in:
parent
300c3b4ed4
commit
f09b16cade
2 changed files with 10 additions and 18 deletions
|
@ -201,16 +201,12 @@ class RelationController < ApplicationController
|
|||
def relations_for_object(objtype)
|
||||
relationids = RelationMember.find(:all, :conditions => ['member_type=? and member_id=?', objtype, params[:id]]).collect { |ws| ws.id }.uniq
|
||||
|
||||
if relationids.length > 0
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
Relation.find(relationids).each do |relation|
|
||||
doc.root << relation.to_xml_node
|
||||
end
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
else
|
||||
render :nothing => true, :status => :not_found
|
||||
Relation.find(relationids).each do |relation|
|
||||
doc.root << relation.to_xml_node
|
||||
end
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -140,16 +140,12 @@ class WayController < ApplicationController
|
|||
def ways_for_node
|
||||
wayids = WayNode.find(:all, :conditions => ['node_id = ?', params[:id]]).collect { |ws| ws.id }.uniq
|
||||
|
||||
if wayids.length > 0
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
|
||||
Way.find(wayids).each do |way|
|
||||
doc.root << way.to_xml_node
|
||||
end
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
else
|
||||
render :nothing => true, :status => :bad_request
|
||||
Way.find(wayids).each do |way|
|
||||
doc.root << way.to_xml_node
|
||||
end
|
||||
|
||||
render :text => doc.to_s, :content_type => "text/xml"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue