Dominik Mayer wrote:
thanks for your reply! sadly this only works for ENV['VERSION'] but not for
  ENV['RAILS_ENV']

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'
  Rake::Task['db:drop'].invoke

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'
  sh("rake db:drop")

--
Phusion | The Computer Science Company

Web: http://www.phusion.nl/
E-mail: [email protected]
Chamber of commerce no: 08173483 (The Netherlands)
_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to