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
The issue is the location of pg_config. If you use the one-click installer, it is in /Library/PostgreSQL/9.2/bin/pg_config, so this will build your gem just fine:
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Library/PostgreSQL/9.2/bin/pg_config