[Rake-devel] How to pass arguments to Rake::Task['name'].invoke ?

Dominik Mayer dominik.mayer at beagile.de
Tue Jan 13 09:43:30 EST 2009

Am Dienstag, den 13.01.2009, 11:43 -0200 schrieb Luis Lavena:
> Looks like your rails environment already initialized? your task is
> depending on :environment?
yes it is.

> You should try setting ENV['RAILS_ENV'] and also changing RAILS_ENV
> constant (or at list check if it's defined).
i already tried that, without success.

Am Dienstag, den 13.01.2009, 14:54 +0100 schrieb Hongli Lai:
> That's because Rails is already loaded when your Rakefile is loaded.

>  If you want to enforce a different RAILS_ENV, then you must launch a
> new Rake process which will re-initialize Rails. For example:
>    ENV['RAILS_ENV'] = 'test'
>    sh("rake db:drop")
or like i'm doing it now:

  system('rake db:drob RAILS_ENV=test') 

seems like there is no other way. 
thanks anyway for your help!


More information about the Rake-devel mailing list