Get Rails root directory


Use either RAILS_ROOT or Rails.root
In Rails 2.3 Rails.root is an instance of Pathname where RAILS_ROOT is a string.

To avoid different file paath system, 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.

No comments

Powered by Blogger.