Graident to follow a specific Path

I'm using Photoshop CS4 and I just need some help with how to make a gradient follow a path.

So for example a gradient of red to blue following a curvy path. All i can do is "stroke path" with the options listed. =[

Help?

to be more specific I'm actually trying to use the a rainbow gradient. so it'll have numerous colours.