Not sure what happened but when I upgraded to Mavericks it says that Rails it not install. I executed the following command:
rails --version
I had the same problem which I have now been able to solve.
The problem for me was that I had updated to the latest version of Xcode through the appstore but hadn't actually opened the application to complete the install. So here's what solved it for me:
Hope it works for you too.