diff options
author | Michael Koziarski <michael@koziarski.com> | 2006-03-28 00:59:55 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2006-03-28 00:59:55 +0000 |
commit | 66f546644b52394a60f6c17cfb544f86aac3b824 (patch) | |
tree | 7a902ce4401cddd33bf6b291d49a1b0d993f7bbd | |
parent | b6e7cc63de744c08f7b310ab879ff20af17572e8 (diff) | |
download | rails-66f546644b52394a60f6c17cfb544f86aac3b824.tar.gz rails-66f546644b52394a60f6c17cfb544f86aac3b824.tar.bz2 rails-66f546644b52394a60f6c17cfb544f86aac3b824.zip |
Allow load_fixtures to load a subset of total fixture data. [Chad Fowler]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 6 | ||||
-rw-r--r-- | railties/lib/tasks/databases.rake | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 9d58def4be..b2d1fcd2b0 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,11 @@ *SVN* +* Allow db:fixtures:load to load a subset of the applications fixtures. [Chad Fowler] + + ex. + + rake db:fixtures:load FIXTURES=customers,plans + * Update to Prototype 1.5.0_pre1 [Sam Stephenson] * Update to script.aculo.us 1.6 [Thomas Fuchs] diff --git a/railties/lib/tasks/databases.rake b/railties/lib/tasks/databases.rake index 964613e8c1..e4da9aff78 100644 --- a/railties/lib/tasks/databases.rake +++ b/railties/lib/tasks/databases.rake @@ -5,16 +5,16 @@ namespace :db do Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby end - namespace :fixtures do - desc "Load fixtures into the current environment's database" - task :load => :environment do - require 'active_record/fixtures' - ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) - Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.{yml,csv}')).each do |fixture_file| - Fixtures.create_fixtures('test/fixtures', File.basename(fixture_file, '.*')) - end - end - end + namespace :fixtures do + desc "Load fixtures into the current environment's database. Load a single fixture using FIXTURE=x" + task :load => :environment do + require 'active_record/fixtures' + ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) + (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'test', 'fixtures', '*.{yml,csv}'))).each do |fixture_file| + Fixtures.create_fixtures('test/fixtures', File.basename(fixture_file, '.*')) + end + end + end namespace :schema do desc "Create a db/schema.rb file that can be portably used against any DB supported by AR" |