我有需要將我的heroku應用程序用於生產的數據。當我運行heroku運行rake db:seed命令時出現錯誤,「rake中止了!目錄中沒有這樣的文件」Heroku rake任務文件路徑錯誤
我試過創建一個自定義rake任務,並且出現同樣的錯誤。
我rake任務的開始是如下:
require 'csv'
CSV.foreach("/Users/username/Documents/Apps Folder/myapp/seed_file.txt") do |row|
...
end
不知道如果我的問題是,我有我的CSV文件的位置,或者如果它是別的東西,我一直在等相關的問題上顯得stackoverflow和他們一直無法解決我的問題。有誰知道如何解決這個問題?
編輯:我已經加我收到終端的錯誤消息當我嘗試運行下面我自定義的耙子任務:
Running `rake customraketask` attached to terminal... up, run.8243
rake aborted!
No such file or directory -/Users/username/Documents/Apps Folder/myapp/app/assets/files/seed_file.txt
/app/lib/tasks/customraketask.rake:13:in `block in <top (required)>'
Tasks: TOP => customraketask
(See full trace by running task with --trace)
我使用了File.expand_path,它給了我絕對路徑,它與我已經寫過的相同,所以我仍然得到相同的錯誤 – Reuben
Paste整個錯誤到你的問題。 – Momer
我粘貼了上面的錯誤消息 – Reuben