Useful Ruby Pathname method

If you have a Ruby Pathname Show archive.org snapshot , you can use the method :/ Show archive.org snapshot to append filepaths to it.

With this method, Ruby code can look like this:

Rails.root/"features"/"fixtures"/"picture.jpg"

Alternatively you can use the #join method, which feels less magic:

Rails.root.join('features', 'fixtures', 'picture.jpg')
Niklas Hä. Over 3 years ago