Place the flour, polenta, butter and Parmesan in a food processor and whizz until the mixture resembles fine breadcrumbs. Alternatively, mix together the rice flour and polenta in a bowl. Add the butter and rub in with fingertips until the mixture resembles fine breadcrumbs. Stir in the Parmesan.
Mix together the egg yolk and milk in a separate bowl and add enough to the dry ingredients to form a soft but not sticky dough. Wrap the dough in clingfilm and chill for 30 minutes. Roll the dough out on a surface lightly dusted with rice flour and use to line a 20 cm (8 inch) fluted tart tin. Prick the pastry base with a fork and place in a preheated oven, 200°C (400°F), Gas Mark 6, for 10 minutes. Remove from the oven.
Make the filling while the pastry is cooking. Heat the oil in a frying pan and soften the shallot and garlic for 2–3 minutes. Add the spinach and cook for 3–4 minutes until wilted and any moisture has evaporated.
Beat together the ricotta, crème fraîche, half the Parmesan and the eggs in a bowl, then season well with nutmeg and salt and pepper. Stir in the spinach and pour into the tart case, sprinkle over the remaining Parmesan and return to the oven for 20 minutes until firm and golden.