make the rainbow out of gumpaste far enough ahead of time so it has time to dry really well. Then attach two sucker sticks to the back with melted chocolate wafers - you could even match the colors if you want to. Be sure they extend down from the bottom of the rainbow a few inches so you can push the exposed stick ends down into the cake. Also, they need to be high enough up on the rainbow to support it, about half to 2/3 it's height. You could also make the rainbow out of royal icing using the run-in technique. Whichever you prefer.
If you make it out of gumpaste you can insert thin wood skewers into the bottom and let it lay flat for several days to dry. Do not be tempted to move them just to see, this will weaken the support once dry you can prop it up on styrofoam till you are ready for your cake. good luck.
Quote by @%username% on %date%
%body%