From b2039ccdcd2e5feefa9e96c8d8b434305a4ff8a8 Mon Sep 17 00:00:00 2001 From: Kevin Triplett Date: Sat, 23 Jul 2011 14:38:40 -0500 Subject: [PATCH] compatibility update for rails 3.1 cherry-picked commit 65b8bae892cc18129753 from iortega/db-populate, replacing deprecated RAILS_ROOT in favor of Rails.root --- lib/tasks/populate.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/tasks/populate.rake b/lib/tasks/populate.rake index 0f35e41..f777b6c 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