How to set environment when calling rake task inside another

This is what I have inside a rake task. In this rake task I need to call
another rake task called email:send_messages. However I need to pass the
RAILS_ENV as ‘staging’.

Rake::Task[“rake:email:send_messages”].invoke

I tried a lot of variations but none of them work.

Rake::Task[“rake:email:send_messages”].invoke RAILS_ENV=staging
Rake::Task[“rake:email:send_messages RAILS_ENV=staging”].invoke

Any thoughts.

Raj S. wrote:

This is what I have inside a rake task. In this rake task I need to call
another rake task called email:send_messages. However I need to pass the
RAILS_ENV as ‘staging’.

Rake::Task[“rake:email:send_messages”].invoke

I tried a lot of variations but none of them work.

Rake::Task[“rake:email:send_messages”].invoke RAILS_ENV=staging
Rake::Task[“rake:email:send_messages RAILS_ENV=staging”].invoke

Any thoughts.

ask fred. he is guru.
we needs an ‘ASK FRED’ web site.

lol.

On 26 Dec 2007, at 23:51, Raj S. wrote:

Rake::Task[“rake:email:send_messages”].invoke RAILS_ENV=staging
Rake::Task[“rake:email:send_messages RAILS_ENV=staging”].invoke

Random guess: set ENV[‘RAILS_ENV’] before you invoke that rake task.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs