Pathname#join ignores previous paths when absolute path passed
irb(main):009:0> Pathname('/foo').join('bar', 'baz')
=> #<Pathname:/foo/bar/baz>
irb(main):010:0> Pathname('/foo').join('bar', '/baz')
=> #<Pathname:/baz>
In second, join
ignores first string because of second sring has absolute path format.
Read other posts