From there, it's a simple matter of installing each package and configuring them properly. To walk you through the entire process would take pages of posts, so I would suggest installing and correctly configuring each one-by-one (start with mySQL, then php, then Ruby on Rails), making sure each works as you expect before moving on. Stop by here if you hit a stuck point or run into problems and we'll help you through them as the problems happen.
Alternatively, here's an easy one-stop package for mySQL, php and Apache for Mac OS X that is guaranteed not to screw with any Mac OS X settings and is easy to remove: