On Wed, Dec 10, 2008 at 1:05 PM, Michael Koziarski <[email protected]>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").to_s
> > => "/tmp/foo"
> >>> (Rails.root + "tmp/foo").to_s
> > => "/Users/geoff/Sites/edgerails/tmp/foo"
>
> Man that's weird!


It is cool, though -- for instance, you can also do this:

Rails.root + '../foo'

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.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to