compatibility update for rails 3.1
cherry-picked commit 65b8bae892cc18129753 from iortega/db-populate, replacing deprecated RAILS_ROOT in favor of Rails.root
This commit is contained in:
parent
f1190e06c8
commit
127334ac1c
@ -2,16 +2,16 @@ namespace :db do
|
|||||||
|
|
||||||
desc "Loads initial database models for the current environment."
|
desc "Loads initial database models for the current environment."
|
||||||
task :populate => :environment do
|
task :populate => :environment do
|
||||||
require 'create_or_update'
|
require File.join(File.dirname(__FILE__), '/../lib', 'create_or_update')
|
||||||
Dir[File.join(RAILS_ROOT, 'db', 'populate', '*.rb')].sort.each do |fixture|
|
Dir[File.join(Rails.root, 'db', 'populate', '*.rb')].sort.each do |fixture|
|
||||||
load fixture
|
load fixture
|
||||||
puts "Loaded #{fixture}"
|
puts "Loaded #{fixture}"
|
||||||
end
|
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
|
load fixture
|
||||||
puts "Loaded #{fixture}"
|
puts "Loaded #{fixture}"
|
||||||
end
|
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
|
load fixture
|
||||||
puts "Loaded #{fixture}"
|
puts "Loaded #{fixture}"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user