Maybe I missed this in the upgrade documentation, but if I output "Rails.root" in the rails console I see my app's root path. But if I reference "Rails.root" in a custom Rake task, it's empty. What am I missing? Thanks in advance.
Sample:
namespace :admin do
desc "Import some data"
task :import => :environment do
csv = Rails.root + "/test/data.csv"
raise "#{csv} does not exit. Stopping task." if !File.exists?(csv)
CSV.foreach(csv, :headers => :first_row) do |row|
puts(row['id'])
end
end
end
I get an exception every time because "Rails.root" is "".