X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2a38dca0b780b972ff93b4cae1bc37c1d476dffa..ba481319f4c86528054c0490a0846ea7474c6612:/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|