diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-22 06:43:03 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-22 06:43:03 +0000 |
commit | 9b0b66b7b7d220ab17c77d508e532ee21ba230a7 (patch) | |
tree | 367cb612c42729fbadee05c69b3c0e19a66e13a1 /railties/fresh_rakefile | |
parent | 1aab0e2c30510acb0dbaf3a2f76bea0971709461 (diff) | |
download | rails-9b0b66b7b7d220ab17c77d508e532ee21ba230a7.tar.gz rails-9b0b66b7b7d220ab17c77d508e532ee21ba230a7.tar.bz2 rails-9b0b66b7b7d220ab17c77d508e532ee21ba230a7.zip |
Added load_fixtures task to the Rakefile, which will load all the fixtures into the database for the current environment #1791 [Marcel Molina]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1879 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/fresh_rakefile')
-rwxr-xr-x | railties/fresh_rakefile | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/railties/fresh_rakefile b/railties/fresh_rakefile index 5407e140f1..8e88a4e85f 100755 --- a/railties/fresh_rakefile +++ b/railties/fresh_rakefile @@ -199,4 +199,13 @@ end desc "Migrate the database according to the migrate scripts in db/migrate (only supported on PG/MySQL). A specific version can be targetted with VERSION=x" task :migrate => :environment do ActiveRecord::Migrator.migrate(File.dirname(__FILE__) + '/db/migrate/', ENV["VERSION"] ? ENV["VERSION"].to_i : nil) -end
\ No newline at end of file +end + +desc "Load fixtures into the current environment's database" +task :load_fixtures => :environment do + require 'active_record/fixtures' + ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) + Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.yml')).each do |fixture_file| + Fixtures.create_fixtures('test/fixtures', File.basename(fixture_file, '.*')) + end +end |