Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow load_fixtures to load a subset of total fixture data. [Chad Fow…

…ler]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 66f546644b52394a60f6c17cfb544f86aac3b824 1 parent b6e7cc6
@NZKoz NZKoz authored
Showing with 16 additions and 10 deletions.
  1. +6 −0 railties/CHANGELOG
  2. +10 −10 railties/lib/tasks/databases.rake
View
6 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]
View
20 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"
Please sign in to comment.
Something went wrong with that request. Please try again.