Maybe we could issue a warning when people try to call Pathname#+ with
a String argument? And suggest the usage with Pathname#join.
If people still want to concatenate, they should do it the ugly way:
Rails.root.to_s + '/tmp/foo'.
Man that's weird!
> Not intuitive, I agree. String interpolation, however, works as
> expected:
>
>>> "#{Rails.root}/tmp/foo"
> => "/Users/geoff/Sites/edgerails/tmp/foo"
This is a little iffy, but I'd like to let this sit in edge for a
while and we'll see what other surprises are lurking in there.
We'll probably need to make sure this is well documented in the
eventual 2.3 release notes, or rolled back if it's too painful to make
a smooth migration path for users.
--
Cheers
Koz
Man that's weird!
> Pathname #+ just coerces the argument to a pathname before
> concatenating, so that it can return another pathname instance. The
> problem with Mislav's example is the preceding "/" on "/tmp/foo":
>
>>> (Rails.root + "/tmp/foo").to_s
> => "/tmp/foo"
>>> (Rails.root + "tmp/foo").to_s
> => "/Users/geoff/Sites/edgerails/tmp/foo"