diff --git a/lib/tasks/populate.rake b/lib/tasks/populate.rake index 0f35e41..79a0302 100644 --- a/lib/tasks/populate.rake +++ b/lib/tasks/populate.rake @@ -2,16 +2,16 @@ namespace :db do desc "Loads initial database models for the current environment." task :populate => :environment do - require 'create_or_update' - Dir[File.join(RAILS_ROOT, 'db', 'populate', '*.rb')].sort.each do |fixture| + require File.join(File.dirname(__FILE__), '/../lib', 'create_or_update') + Dir[File.join(Rails.root, 'db', 'populate', '*.rb')].sort.each do |fixture| load fixture puts "Loaded #{fixture}" end - (Dir[File.join(RAILS_ROOT, 'db', 'populate', RAILS_ENV, '*.rb')] + Dir[File.join(RAILS_ROOT, 'db', 'populate', 'shared', '*.rb')]).sort{|x,y| File.basename(x) <=> File.basename(y)}.each do |fixture| + (Dir[File.join(Rails.root, 'db', 'populate', Rails.env, '*.rb')] + Dir[File.join(Rails.root, 'db', 'populate', 'shared', '*.rb')]).sort{|x,y| File.basename(x) <=> File.basename(y)}.each do |fixture| load fixture puts "Loaded #{fixture}" end - Dir[File.join(RAILS_ROOT, 'db', 'populate', 'after', '*.rb')].sort.each do |fixture| + Dir[File.join(Rails.root, 'db', 'populate', 'after', '*.rb')].sort.each do |fixture| load fixture puts "Loaded #{fixture}" end