public
Fork of mbleigh/seed-fu
Description: Advanced seed data handling for Rails, combining the best practices of several methods together.
Homepage: http://mbleigh.lighthouseapp.com/projects/10223-seed-fu
Clone URL: git://github.com/zdennis/seed-fu.git
Introduced the FIXTURE_PATH environment variable for the db:seed rake task 
so you can store fixtures in a place besides db
zdennis (author)
Wed Jul 16 13:38:59 -0700 2008
commit  4d391aa214c369f161e37c194b07d49e55312b35
tree    a6d0c242a7855b9b956bd7f06f98908740b1133d
parent  93e54062cec39aad5249c4dbcc35bcaa8efcf633
...
1
2
3
4
 
 
5
6
7
8
9
 
10
11
12
...
1
2
3
 
4
5
6
7
8
9
 
10
11
12
13
0
@@ -1,12 +1,13 @@
0
 namespace :db do
0
   desc "Loads seed data from db/fixtures for the current environment."
0
   task :seed => :environment do
0
- Dir[File.join(RAILS_ROOT, 'db', 'fixtures', '*.rb')].sort.each { |fixture|
0
+ fixture_path = ENV["FIXTURE_PATH"] ? ENV["FIXTURE_PATH"] : "db/fixtures"
0
+ Dir[File.join(RAILS_ROOT, fixture_path, '*.rb')].sort.each { |fixture|
0
       puts "\n== Seeding from #{File.split(fixture).last} " + ("=" * (60 - (17 + File.split(fixture).last.length)))
0
       load fixture
0
       puts "=" * 60 + "\n"
0
     }
0
- Dir[File.join(RAILS_ROOT, 'db', 'fixtures', RAILS_ENV, '*.rb')].sort.each { |fixture|
0
+ Dir[File.join(RAILS_ROOT, fixture_path, RAILS_ENV, '*.rb')].sort.each { |fixture|
0
       puts "\n== [#{RAILS_ENV}] Seeding from #{File.split(fixture).last} " + ("=" * (60 - (20 + File.split(fixture).last.length + RAILS_ENV.length)))
0
       load fixture
0
       puts "=" * 60 + "\n"

Comments

    No one has commented yet.