29 Aug 2012, 15:55
Generic-user-small

Timothy Western (1 post)

While running through the Churn-tests I noticed the following error:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
churn (LoadError)
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from churn-tests.rb:7:in `<main>'

I did some research and came upon the following article on StackOverflow:http://stackoverflow.com/questions/2900370/why-does-ruby-1-9-2-remove-from-load-path-and-whats-the-alternative

What it boils down to, is an apparent security fix to ruby that changes how you have to do the Requires. I’ve tried both methods below:

File.expand_path(FILE)

and

require ‘./filename’

and

require_relative ‘filename’

forms all seem to work in replacing the require syntax used. So you could use it like one of the below patterns and it would work.

require ‘./churn’
require File.expand_path(‘churn.rb’) require_relative ‘churn’

Thought I would pass this on, in case anyone ran into the same issue that I did.

01 Oct 2012, 07:12
Generic-user-small

d3vin h (4 posts)

just encountered this error and followed your advice. thx for the post.

  You must be logged in to comment