Last Updated: February 25, 2016
·
321
· hidakatsuya

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

See: http://doc.ruby-lang.org/ja/1.9.3/class/Pathname.html