Looks like the root-cause of this is that I had config.threadsafe!
enabled in the config files.
To fix this, do this:
# only enable threadsafe! mode if we are not running rake tasks
config.threadsafe! unless File.split($0).last == 'rake' # unless it's a rake task