Rbenv is another option that we can use besides RVM to be able to manage different Ruby versions. I have always struggled to get RVM to manage everything right, from gemsets to bundles. Since Bundler manages your gems and dependencies for you, gemsets are just an extra layer that caused me a bunch of problems. So I switched to Rbenv for my production environment. All went well except delayed_job. It would work just fine with rake jobs:work, but script/delayed_job start would start just fine, but wouldn’t pull anything from the database. I am using Mongoid, so I assumed that the script was defaulting to the sqlite database.

Well, I looked at the script and noticed that there was a shebang at the top mentioning ruby (#!/usr/bin/env ruby). I just changed it from ruby to ruby-local-exec and it started working again! This made the script run in the bundled environment and pick up on the fact that I am using Mongoid instead of sqlite. Hope this helps someone.