I used to get cramps when I just drank water on anything over about 60km, I used to talk little salt packets out with me to deal with it, but have since switched to using electrolyte tabs in my water bottles (I rather like the Wiggle own brand lemon ones if you're in the UK) for anything that will take more than about 4h and (touch wood) seems to be fine now as long as I remember to drink. I did a hundred mile ride last week when it was fairly warm and only drank one 750ml bottle each way (with electrolytes) and had no hint of cramps.