I just learned the hard way that running rake tasks on your development machine doesn't mean it uses the development rails environment. In fact, if you don't specify, it puts you in production!
I was trying to run a DelayedJob worker that cross posts to Twitter. I was trying to sign the rest api call to Twitter, but I use a token / secret depending on the environment. Unfortunately, running the DelayedJob locally, I didn't specify development environment, so it kept using the wrong token/secret pair to successfully sign my Twitter request.
Finally, this worked:
rake jobs:work RAILS_ENV=development