Rails environment how to find out in code?

are there any solutions how I can find out in which environment my application is running?

I have some rake calls wich need to have the environment like this:

system "RAILS_ENV=development rake crons:dosomething"

But this should not only work in development I want to use this in test production and development?

how can I do this?

second task where I need this is in config/schedule.rb the should also run in all environments

rake "crons:dosomething", :environment => :development
rake "crons:dosomething", :environment => :production

this dosn’t work


Source: ruby

Leave a Reply