Read more

Useful Ruby Pathname method

Niklas Hä.
August 13, 2020Software engineer at makandra GmbH

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

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

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')
Posted by Niklas Hä. to makandra dev (2020-08-13 13:44)