1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Michael Koziarski 2006-03-28 00:59:55 +00:00
parent b6e7cc63de
commit 66f546644b
2 changed files with 16 additions and 10 deletions

View file

@ -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 file

@ -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"