Rainbowfish are very ACTIVE swimmers, who despite their smaller size, actually do best in a LONG tank. The exception to that would be the Dwarf Neon Rainbowfish (Praecox Rainbowfish) which grows to about 3" in length (but sometimes a bit smaller in a home aquarium), that requires only about 2+ feet in tank length.
Larger rainbowfish like Boesemann or Turquoise Rainbowfish (very common in the hobby) require a MINIMUM of 4 feet in length, but would do best in an even longer tank.
I second Cezza's advice to buy the biggest tank you can afford. Larger volumes of water are easier to keep stable than smaller volumes, and it will greatly open up your stocking options, plus allow you to keep more individuals as well. Getting a larger tank doesn't necessarily mean that you have to get larger fish. I have a 6 foot long tank that I am putting fish that grow no larger than 3 inches into. But, with that amount of space, I can put really large shoals of fish in it, which makes for a far more stunning display, in my opinion. Going with a small tank requires small fish in small numbers. Big tanks allows for either big fish, or big numbers of small fish. Personally, I lean to the latter.