Rails Root directory path?

后端 未结 9 1271
攒了一身酷
攒了一身酷 2020-11-30 16:40

How do I get my Rails app\'s root directory path?

9条回答
  •  天命终不由人
    2020-11-30 17:26

    For super correctness, you should use:

    Rails.root.join('foo','bar')
    

    which will allow your app to work on platforms where / is not the directory separator, should anyone try and run it on one.

提交回复
热议问题