I always eat before a race, but it depends on distance and starting time. My strategy for longer races is to eat a quality meal the night before (not necessarily pasta) and have a few bowls of cereal before I go to bed. The morning of:
A. Something light - granola bar, muffin, etc.
B. Half a bagel or bowl of cereal
C. Since I'm assuming you are including 20 miles as your longest training run, I'll eat half or a full bagel, depending on how hungry I am, but I"ll bring food for the run, just in case. I always run with a granola bar in my hand bottle anyway. On my training runs, though, I rarely eat unless I'm going out for longer than three hours or two hours on trails.
D. Full bagel and extra depending on the race start. If I have to travel to the race or if I have a wait at a corral, I'll bring a granola bar or apple.
Race day diet is entirely personal preference. As a rule of thumb, you don't really need food unless you're going longer than three hours, and its important that you don't *overeat* during a race. Definitely don't listen to people when they say to have a gel every 45 minutes, I think that's insanity. Definitely don't listen to redhouse when he says you need food after 40 minutes. A solid strategy for a marathon or long run would be two or three gels max, like Gen Lee said, and eat them before you get hungry. However, if you plan on being on the course for 4-5 hours +, you'll probably want something solid towards the end, since the thought of another gel will make you want to hurl. M&Ms, raisins, and pretzels are all good options and can be carried easily. Experiment with different foods and gels and see what works, and check what the race gives out. You don't want to be eating some off-brand product the day of the race that you haven't trained with.