[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-16 Thread Geoff B
On Dec 12, 1:30 pm, "David Masover" wrote: > Yes, this will work with strings also -- but Pathnames are smart enough to > actually interpret those relative paths before passing them to 'require' and > friends. ... which is a helpful feature -- you can end up requiring a file twice if you pass tw

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-12 Thread David Masover
On Wed, Dec 10, 2008 at 1:05 PM, Michael Koziarski wrote: > > > 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

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-10 Thread Michael Koziarski
> 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

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-09 Thread Damian Janowski
On Sun, Dec 7, 2008 at 8:10 PM, Mislav Marohnić <[EMAIL PROTECTED]> wrote: > Changing Rails.root to a Pathname was great and all (I'm a strong believer > that us Rubyists shouldn't handle paths or URLs as String objects), but > there's one thing I've discovered just now that kinda ruins the joy. >

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-08 Thread Geoff B
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/

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-08 Thread Ryan Bates
I do think this should be addressed. Why is the "+" operator overridden in Pathname in the first place? Is there some benefit to this way of concatenating that I'm not seeing? Rails.root + "/foo" should append "/foo" to the end of Rails.root. That's what the code says anyway. Regards, Ryan On

[Rails-core] Re: Problem with Rails.root being a Pathname

2008-12-08 Thread Chris Cruft
I know of at least two of my apps that will break. But I also agree with the sentiment of dealing with a slightly higher abstraction than just strings when working with the filesystem. So I'm willing to pay the (small) price and I thank you for bringing it to my attention! On Dec 7, 5:10 pm, "Mi