title: Executing the db:seed task for development
body: <p>I have the following task:</p>
  
  <pre><code>namespace :db do
    desc "Drop, create, migrate, seed the database and prepare the test database for rspec"
    task :reset_db =&gt; :environment do
      puts "Environment Check: Rails Environment = #{Rails.env}"
      Rake::Task['db:drop'].invoke
      Rake::Task['db:create'].invoke
      Rake::Task['db:migrate'].invoke
      #Rake::Task['db:fixtures:load'].invoke
      Rake::Task['db:test:prepare'].invoke
      puts 'Seeding Database..'
      Rake::Task['db:seed'].invoke
    end
  end
  </code></pre>
  
  <p>This task works fine up to the last <code>db:seed</code> line.<br>
  It seems to be using the <code>test</code> environment and creates the data there, while all the other tasks execute in the <code>development</code> environment. When I execute <code>rake db:seed</code> via the command line, it runs correctly in the <code>development</code> environment.</p>
  
  <p>How can I prevent it from running in the <code>test</code> environment?</p>