If anybody tells you they know the answer, they're lying. I think some people are more prone to cramp than others. There is soft whispering circulating that muscles that HAVE cramped are more likely TO cramp again in the future, not sure how reliable that is but I know I periodically get nasty cramps on the bike. I'd say the usual cause is doing something harder than I am recently used to doing along with a combination of weather I'm not used to (usually hotter but I got horrible cramps once in pretty cool weather). Hydration probably plays a role in hot weather too. If they're mild enough to ride through then just ride through. I've tried all the wives tale cures - pickle juice, mustard, Billy Bob's scientifically proven hydration formula...Meh.