我在heroku上运行一个应用程序 - 它看起来运行得很好,我可以访问我的数据库.现在,我试图运行'heroku rake db:seed'...运行,直到它在我的代码中达到这一点;
composersInput = IO.readlines("app\\data\\composers.txt")
composersInput.length.times do |i|
name, borndied, nationality, style, gender = composersInput[i].split(':')
yearBorn, yearDied = borndied.split('-')
Composer.create!(:name => name, :year_born => yearBorn.to_i, :year_died => yearDied.to_i,
:nationality_id => nationality.to_i, :style_id => style.to_i, :gender => gender)
end
Run Code Online (Sandbox Code Playgroud)
当它尝试加载composers.txt时,我收到以下错误"没有这样的文件或目录 - app\data\composers.txt",我非常无能为力.这段代码适用于我的本地副本并且执行没有问题 - 我已经验证了文件composers.txt确实在我的机器上的那个目录中,并且我验证它们被包含在git push to heroku中.
我想知道是否有什么问题.我的IO语法?有没有办法让我浏览我的heroku应用程序的文件结构,以便我可以验证文件确实存在?如果您有任何建议,将非常感谢:)