X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/974e404a6e21e953354c38fc71338deb259f13ed..49fac49f9d6a3d49c2cd56b605ee1ba9323dffb6:/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|