Do you want to know how it's done? Learn how to use Photoshop the easy way!
Next you will want to make sure you are in the proper gradient group. Select the "Special Effects" group from the drop down menu.
Now you will need to select the rainbow gradient and you are ready to create.
You will also need to make sure that the radial gradient is selected.
Now create a new layer. In my case here where I have control over the other layers of my picture, I will put the rainbow layer in between the sky and the grass with the grass layer being on top.
With the gradient tool and your rainbow layer selected, drag across the layer to create a rainbow. If you do not like what you see, hit Ctrl+z and try it again.
Now set the layer blend mode to "screen" from the drop down menu.
And there you have it. If it seems a bit dark on your picture, reduce the opacity of the rainbow layer a bit.
Now it you are trying to put a rainbow on a picture that you do not have control over, you will have to do a bit of erasing to get how much of the rainbow you want in the picture.
Either way you should be able to create the same result.