Hi,
I just found a patch about importing a csv file in a migration:
http://dev.rubyonrails.org/ticket/5293
This feature would be great, but the patch seems to sleep
Perhaps anyone could attend to this patch?
Thanks, Beate
Hi,
I just found a patch about importing a csv file in a migration:
http://dev.rubyonrails.org/ticket/5293
This feature would be great, but the patch seems to sleep
Perhaps anyone could attend to this patch?
Thanks, Beate
This a rake script by technoweenie I believe, I modified it to stip out schema.rb importing.
namespace :db do
desc "Loads the initial database fixtures."
task :bootstrap => ['db:bootstrap:load']
namespace :bootstrap do
desc "Load initial database fixtures (in db/bootstrap/*.{yml,cvs}) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
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, 'db', 'bootstrap', '*.{yml,csv}'))).each do |fixture_file|
Fixtures.create_fixtures('db/bootstrap', File.basename(fixture_file, '.*'))
end
end
end
end
Stick it in lib/tasks/bootstrap.rake then each time you do rake db:migrate
run rake db:bootstrap too