From: Ammar Ali Date: 2010-11-05T23:51:14+09:00 Subject: Re: require problem On Fri, Nov 5, 2010 at 4:26 PM, Roni Kekkonen wrote: > Hello. I am working with the book "Everyday scripting with Ruby" (The > Pragmatic Programmers) and I'm at chapter 7 where I have touse require > to load up a file I have made myself (churn.rb). But everytime I run my > program, it complains the following: > > (internal:lib/rubygems/custom_require):29:in 'recuire': no such file to > load -- churn (LoadError) >      from (internal:lib/rubygems/custom_require):29:in 'require >      from churntests.rb:2:in '(main)' > > now, both files 'churn.rb' and 'churntests.rb' are in the same folder > (I'm programming under Windows) so churn should work. I even tried to > see if the textbook's files would work and even with them I got the same > error message. > > I just can't understand it... I mean, I have the following lines at the > beginning of my churntests.rb: > > require 'test/unit' > require 'churn' Ruby 1.9 no longer includes the current directory in the load path. Add a './' before the file name, like so: require './churn' There are other options as well, like require_relative, and adding the current directory to the load path. I leave them up to you to investigate. It's remarkable how much confusion this change has caused. Especially for people with older books who insist that they typed the code *exactly* as it in the book. It is a change for the better though. What's up with the 'recuire' (c instead of q) in the error message? Did you edit it? Regards, Ammar