Pre-ride.
Eat something medium-sized a couple of hours before you ride, focusing more on the carb side of the house. Not too much fat.
During the ride, look for something like 250-350 calories. Don't go longer than 30 minutes without eating, but you should never feel close to full. Drink enough water so that you have to take a bathroom break every hour or two.
If your goal is to loose weight, my advice is to do rides in the 2-3 hour range. That's long enough that you have to pull calories out of your fat reserves, but short enough that most people can do it.
You might also consider finding an energy drink that works well for you. Bike shops carry a number of options. That means you have to eat less solid food while you ride (not much at all, really), but more importantly, it keeps your blood sugar constant so that you aren't that hungry at the end of your ride. Exercise-induced appetitite suppression is your friend.