My rule of thumb is to eat on any ride that is over 90min long. Then, the minimum you should do is one “eating episode” per hour you will be riding (round up to the next hour, i.e. a 2:45 long ride you should eat a minimum of 3 times). I like to use the term “eating episode” because not every time you reach into your pocket will you be eating the same thing, sometimes it might be a granola bar (100cal) another time it might be half a PB&J sandwich (200cal), but counting the number of times you eat will get you into the right ball-park for calorie intake. Each eating episode should consist of 100-300cal.
While training you’ll be burning between 400-800 calories per hour depending on intensity, personal metabolism, etc., however your gut will only be able to digest and use about 300 calories per hour, so you’ll always end a ride in caloric debt. The more you’re able to reduce that caloric debt, the less hungry you’ll be when you get home (i.e. helpful for weight loss), the longer you’ll be able to ride, and the more energy you’ll have on the ride.
During a training ride I like to eat for the first time about 30-45min into the ride (note: you probably won’t be hungry yet, but learning to eat on schedule should be part of your training) and then every hour after that. If you’re hungry, feel free to eat more often, though remember, anything over 300cal per hour and you’re just filling up your stomach without digesting it into usable energy.