Avoid Typing RAILS_ENV All The Time
I often log into my staging or production servers to run a Rake task or fire up the Rails console. I got fed up long ago with specifying the environment in every command. For example:
$ rake --trace db:migrate:redo RAILS_ENV=production $ script/console production $ rake ts:in RAILS_ENV=production
It just occurred to me to set the environment variable in, er, the environment (
And now I can log in and type simply what I want to type:
$ rake --trace db:migrate:redo $ script/console $ rake ts:in
I am so embarrassed that I didn’t think of this three years ago.