actually I've been learning that you have to cook the beans in a ceratin way. I would soak the beans overnight and I would still get gas. But for 24 hrs?? I also read that vinegar would help.. soaking in vinegar. When serving put cayenne pepper and lemon/lime juice. Another thing is to boil the beans at least 10 minutes at the beginning of cooking. Might want to skim off the foam as well that pops up. Also.. Cook your beans with no salt. That will break down the sugar.
Read these recipes also that might help.
http://www.savvyvegetarian.com/vegetari ... ut-gas.php they have specific instructions for making "beans without gas".
Tbh... all this has been helping me, though I don't know whether soaking for 24 hrs is necessary, I DO know that since I have tried it (only because I didn't have time to make the beans, they sat in my fridge for like 2 days, in vinegar and I always changed the water every so often and put vinegar again, 2 tablespoons) I think it completely eliminated my gas. I'm not too sure though because I did get gas after my grandmother made some and I mixed my beans with hers and I got a little gas. Anyway.. I will be experimenting more.