Wash the aubergines, cut off the ends and cut them into 1cm slices. Layer them in a large bowl, sprinkling coarse salt on each layer. Let them sit for at least 2 hours so that the aubergines will lose their bitterness.
In the meantime, prepare the tomato sauce. Heat up some olive oil, brown the garlic clove and take it out. Add the peeled tomatoes and let it boil until the tomatoes are crushed. Lower the heat and let the sauce thicken. Add the basil leaves towards the end when the sauce is almost ready.
Rinse the aubergines under running water and dry them. Heat up some olive oil in a frying pan and fry the aubergine slices until they are golden brown on both sides. Place them on a piece of kitchen roll to absorb the excess oil.
Boil the spaghetti in salted water till al dente. Meanwhile, cut the aubergine slices into little cubes. Put the aubergine cubes in the tomato sauce and mix. Let them cook together for about 10 minutes so that the sauce flavours the aubergines. Add the ricotta and mix. Season to taste with salt and pepper. Add some more chopped basil.
Drain the pasta when it is al dente, add it to the sauce and warm through for a few minutes before serving.