samayres1992
samayres1992

Reputation: 779

Loading ruby files in different directory? Error "cannot load such file"

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?

Upvotes: 0

Views: 586

Answers (1)

Dan Webb
Dan Webb

Reputation: 64

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

Upvotes: 1

Related Questions