[Rake-devel] How to pass arguments to Rake::Task['name'].invoke ?
hongli at phusion.nl
Tue Jan 13 08:54:39 EST 2009
Dominik Mayer wrote:
> thanks for your reply!
> sadly this only works for
> but not for
> so if i'm in development-environment, the following would not drop my
> test-db (unfortunately it would drop my development-db):
> ENV['RAILS_ENV'] = 'test'
> any other ideas on that?
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'
Phusion | The Computer Science Company
E-mail: info at phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
More information about the Rake-devel