You're passing an absolute path to require_relative. You can do
require_relative library.

That said, in my opinion, require_relative is a misfeature. You should
always put the appropriate paths on the load path, and require things
relative to it. If your library is called "zoom", you should do require
"zoom/library_name", not require File.dirname(__FILE__) + "library_name"
from the zoom directory.

Yehuda Katz
Architect | Engine Yard
(ph) 718.877.1325


On Thu, Sep 9, 2010 at 9:25 AM, byrnejb <[email protected]> wrote:

> Why does Ruby-1.9.2-p0 require an additional ../ for relative paths
> when compared to the same code for ruby1.8?
>
> if RUBY_VERSION < '1.9'
>  require File.dirname(__FILE__) + library
> else
>  require_relative File.dirname(__FILE__) + '/..' + library
> end
>
> --
> 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]<rubyonrails-core%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>

-- 
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