I seem to never remember the steps for this procedure (and I’ve needed it a few times already), so I figured I would just write it down here for future reference.
We need to give instructions to passenger to load up the right gemset in our application’s directory.
Create an .rvmrc file in the web application’s root directory:
Create a new gemset
Edit the .rvmrc file and add the gemset to be used, aswell as the ruby version needed for it
Trust the .rvmrc file
Passenger doesn’t know about our project-specific gems whereabouts so we need to give it an access path to locate them. In order to do this, we create a new file called setup_load_paths.rb in the config folder of the application like so:
Paste the following into the newly create file:
rvm_path = File.dirname(File.dirname(ENV[‘MY_RUBY_HOME’]))
rvm_lib_path = File.join(rvm_path, ‘lib’)
raise “RVM ruby lib is currently unavailable.”
Restart the server and we’re done.