RVM
Ruby Version Manager
http://cheat.errtheblog.com/s/rvm/
To create a new gemset:
rvm ruby-1.9.3-p194@rails2314 --create
To switch to a particular gemset:
rvm gemset use rails2314
Now you can use gem
to install the needed gems.
May need to source /etc/profile.d/rvm.sh
to get things working.