William Notowidagdo Kiranatama Staff
Knowledge


Update: I write a more detailed version of this topic here http://www.ruby-on-rails-outsourcing.com/2011/10/07/how-to-use-phusion-passenger-with-multiple-ruby-versions/

This post will show you how to use RVM with Passenger. You might want to implement this on your testing server when you have to deal with multiple applications which need multiple Ruby version.

First of all, activate REE
$ rvm use ree
then install Passenger Create .rvmrc file in your project directory. In example below my application is using REE.
if [[ -s "/home/user/.rvm/environments/ree-1.8.7-2011.03@rails-app" ]] ; then
  . "/home/user/.rvm/environments/ree-1.8.7-2011.03@rails-app"
else
  rvm --create use  "ree-1.8.7-2011.03@rails-app"
fi
Create config/setup_load_paths.rb
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  begin
    rvm_path     = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
    rvm_lib_path = File.join(rvm_path, 'lib')
    $LOAD_PATH.unshift rvm_lib_path
    require 'rvm'
    RVM.use_from_path! File.dirname(File.dirname(__FILE__))
  rescue LoadError
    # RVM is unavailable at this point.
    raise "RVM ruby lib is currently unavailable."
  end
end
Done. Restart your application if needed. Here are some resources to learn more about RVM and Passenger implementation
  1. The Path to Better RVM & Passenger Integration
  2. Phusion Passenger & running multiple Ruby versions