Are you trying to install / run Rails 3.1 on a FreeBSD system...?
You will probably get errors of a missing javascript engine.
You should try to install node and google V8 as javascript engine
cd /usr/ports/lang/v8 make install clean
cd /usr/ports/www/node make install clean
Now it should work :-)