Rails server daemon working directory

时间:2016-04-04 18:58:09

标签: ruby-on-rails ruby-on-rails-3

So I found out per this question that when you run:

rails server -d

Rails decides that its Dir.pwd is /. So when trying to read a file on the system, I need to execute with full path of said file (File.read("#{Rails.root}/path/to/file"). How can I tell Rails to set Dir.pwd to Rails.root

1 个答案:

答案 0 :(得分:1)

单独使用rails s -d无法解决这个问题。结束Phusion Passenger:passenger start -d

解决了我的问题