views:

39

answers:

0

We're doing an upgrade to Rails 3 (like half the world right now), and I've been diligently replacing usages of RAILS_ENV eg

RAILS_ENV == 'wibble'
# becomes
Rails.env.wibble?

But I'm not as certain of what to do with:

ENV["RAILS_ENV"] ||= 'production'

We've got it at the top of a whole bunch of rake tasks and daemons... and the idea is that you can pass RAILS_ENV on the command-line... but default to 'production' if it's not passed.

I'm not sure of the new, rails3-ish way of doing this - so for now my rails:upgrade:check is complaining mightily of this intrusion of Rails2-ishness...

I don't know if:

::Rails.env ||= 'production'

will work - does it get set for a daemon? does it automagickally get pre-populated with the value of RAILS_ENV passed on the command-line or do we need a new way of invoking the daemons?

Any ideas on the correct mantra for this?