How do you keep garden onions from going to seed?

Onions can tend to bolt if they have inherited it genetically, so seed should not be saved from early bolters. Shortage of water and planting at the wrong time can also be a cause. If your plants are bolting they should be harvested.