I have the following structure:
lib/models/module_name.rb
lib/models/module_name/one.rb
lib/models/module_name/two开发者_如何学JAVA.rb
lib/models/module_name/three.rb
module_name.rb contains the following:
require 'module_name/one'
require 'module_name/two'
require 'module_name/three'
When module_name.rb is loaded I get the error 'No such file to load -- module_name/one (LoadError)'
any ideas? Please excuse my ignorance.
Try using:
require File.dirname(__FILE__) + '/module_name/one'
require File.dirname(__FILE__) + '/module_name/two'
require File.dirname(__FILE__) + '/module_name/three'
Looks like the problem was caused by a problem with virtualbox and windows mounting interaction. Basically the files were moved after I performed a move, but the files were not correctly registered in the linux VM and thus could not be loaded by ruby.
精彩评论