Path generation in Rails3+
Rails.root.join('lib', 'foo.rb')
#=> /path/to/rails_app/lib/foo.rb
Rails.root
is instance of Pathname
.
Rails.root.class
#=> Pathname
Written by Katsuya Hidaka
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Related Tags
#rails
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#