Rails: seed data from fixtures

Suppose you want to collect your seed data from your fixtures…

past the following in you db/seeds.rb – file:
Dir.glob('test/fixtures/*.yml').each do |file|
ActiveRecord::Fixtures.create_fixtures("#{Rails.root}/test/fixtures", File.basename(file).split(".").first)

Works in my new Rails 3.2.10 environment using ruby 1.9.3

Leave a Reply

Your email address will not be published. Required fields are marked *