From: Luis Lavena Date: 2010-10-17T10:05:12+09:00 Subject: Re: require behavior change from 1.8.7 p299 to 1.9.2 p0 On Oct 16, 7:31 pm, Bharat Ruparel wrote: > requiring a file is causing problems for me in Ruby 1.9.2 p0.  This > issue did not happen in Ruby 1.8.7 p299. > http://www.ruby-lang.org/en/news/2010/08/18/ruby-1-9-2-is-released/ "$: no longer includes the current directory." That means "." is not included and thus you can't require things in the same folder (is a security measure) > > info: Using ruby 1.9.2 p0 > > bruparel:~/temp/sin_test > → irb > ruby-1.9.2-p0 > require 'rubygems' >  => true > ruby-1.9.2-p0 > require 'hello_world' > LoadError: no such file to load -- hello_world >   from :29:in `require' >   from :29:in `require' >   from (irb):2 >   from /home/bruparel/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `
' > > However, if I issue a slightly different require command at irb prompt > as shown below: > > ruby-1.9.2-p0 > require './hello_world' >  => true > > Then it works! > > But this is causing all the "old" Ruby 1.8.x programs to break.  Is > there an environment setting in Ruby 1.9.2 that will restore the old > behavior? > severals: ruby -I. my_script.rb require_relative 'hello_world' or play with $: adding the current directory which I would recommend not to. -- Luis Lavena