How do I ask Rails? environment.rb and initializers

Can I ask rails somehow in environment.rb or in an initializer if it runs via a

- script/server - script/console - rake db:migrate - etc.

Maybe something like

if RAILS_MODE == 'Migration' # don't do a Category.find(1) because the category table might not be there puts 'I am in migration mode' end

yeah, but it's RAILS_ENV

I don't understand your answer.

RAILS_ENV is an environment variable I can set with either development, test or production and Rails then behaves differently. Even for migrations you can provide the target like

RAILS_ENV=production rake db:migrate

Maybe you could clarify what you meant?

Feurio