I just upgraded from OS X Lion to OS X Mountain Lion. My rails environment for the most part stayed in tact.
The only steps I had to do to get things back to a good
I have had the same problem but reinstalling postgresql with homebrew did not solve it. However, this command did it for me:
sudo env ARCHFLAGS="-arch x86_64" gem install pg