0

It requires going up in to a parent directory then another parent, then going in a different child > child > thefile.rb.

I've looked through a few posts and all of them seem to be if the files are in pretty much the same directory.

At the moment I have

load '../../lib/classes/X.rb'
load '../../lib/classes/Y.rb'
load '../../lib/modules/Z.rb' 

Everytime I get the error "cannot load such file"

Is there anything I'm missing here?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
samayres1992
  • 779
  • 2
  • 12
  • 30

1 Answers1

1

It's worth trying to load the files in irb first to see if you've got syntax or anything incorrect. I just tried writing nearly exactly the same as you (directory names are different) but it all worked fine.

irb(main):002:0> load '../../Work/Z.rb'

=> true
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Dan Webb
  • 64
  • 4
  • Cheers, I found the reason behind it was it was taking the original path of where ruby is, not where the path of where the file was located. Hope that helps anyone else with similar troubles. – samayres1992 Sep 05 '12 at 11:00
  • Ah, should have remembered. As of ruby 1.9: require_relative. As per this http://stackoverflow.com/questions/6671318/understanding-rubys-load-paths – Dan Webb Sep 05 '12 at 12:19