I have a staging machine with a special \"staging\" environment. I always forget to run rake tasks on that machine like:
rake jobs:work RAILS_ENV=staging
Rails.env = 'staging'
Put this in your task file.
You can put a line that sets the environment variable RAILS_ENV
in a file that will get run when you log onto the machine. For example, I'm a bash user, so I'd put the line
export RAILS_ENV=staging
In either ~/.bashrc (just for me) or /etc/bashrc (for everyone who logs onto the machine).
Hope this helps!