When I go out on longer bike rides (>1.5 hours) I would normally take a gel or two, or a Cliff bar, and eat it somewhere during the ride to replenish the glycogen stores in my body with carbs. However, I don't normally measure the amount of carbs and I would often bonk on long rides and feel completely exhausted towards the end.
I decided to try a more measured approach to fueling my rides, and discovered a lot of information about nutrition before and during rides, especially on the Trainerroad forum, and this excellent article. One convenient solution to making sure you are taking in enough carbs while you ride, is to drink it. There is a limit to how much carbs your body can process in an hour. Top athletes can take 90+ grams of carbs per hour (yes, you can actually 'train your gut') but normal people can really only process up to 60g of carbs per hour. And it it is limited by the type of carb (glucose, sucrose, fructose etc.) so if you want to avoid gut problems while riding, you have to find a mix that works well.
Most high end sports energy drinks (think Skratch Labs, Science in Sport) use a mix of Multodextrin (glucose in an easily digestible form), Sucrose (white sugar) and some flavoring. Instead of just buying the sports drink powder packets, I picked a recipe from the Trainerroad forum and now I make my own mix - Walter White style!!!
For each 750ml bottle, I mix in 50g of carbs:
This is a 2:1.5 ratio of Maltodextrin to Sucrose, which I measure out into individual small ziplock bags and take with me on the longer rides. I make sure to drink a 750ml bottle per hour, and supplement it with some Cliff bars or gels. This works great on long rides.
It comes out to $1.65 per bottle, compared to the pre-made sports drinks like this one at around $3.