I just put them in the ground, next to my potatoes and beans.
Tomatoes next to potatoes are a no-no; precisely for the reason you experienced.