Heat 2 tablespoons of the oil in a large frying pan over a medium heat, add the onions and garlic and cook, stirring occasionally, for 10 minutes until golden.
Meanwhile, cook the pasta in a large saucepan of salted boiling water according to the packet instructions until al dente. Drain and gently toss with the remaining oil.
Add the beetroot, capers and vinegar to the onions and garlic in the pan and heat through. Stir into the pasta. Transfer to a large bowl, including all the juices from the pan, and leave to cool for 5 minutes.
Arrange the ravioli in serving bowls or on plates with the salad leaves and herbs. Serve with a scattering of pecorino shavings, if you like.