X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/699e73a22ad85124cef4a69f6a1848729cf87b32..5047ec403db94b0d371a9a10b56801bc0a3fcf0a:/app/controllers/api/ways/relations_controller.rb diff --git a/app/controllers/api/ways/relations_controller.rb b/app/controllers/api/ways/relations_controller.rb index fcd8b40dd..4188dfe4e 100644 --- a/app/controllers/api/ways/relations_controller.rb +++ b/app/controllers/api/ways/relations_controller.rb @@ -6,13 +6,12 @@ module Api before_action :set_request_formats def index - relation_ids = RelationMember.where(:member_type => "Way", :member_id => params[:way_id]).collect(&:relation_id).uniq - - @relations = [] - - Relation.find(relation_ids).each do |relation| - @relations << relation if relation.visible - end + @relations = Relation + .visible + .where(:id => RelationMember.where( + :member_type => "Way", + :member_id => params[:way_id] + ).select(:relation_id)) # Render the result respond_to do |format|