ruby - Require 'cannot load such file'. Pushed my directory into the $: array -


i solved problem through

require_relative require './whateverfileiplannedtorequire' load 'whateverfileiplannedtorequire' 

but trying require work without ./ @ beginning advertised in the beginning ruby book. hoped pushing cwd $: array fix this, didn't. how manage require work shown in book?

use

$:.unshift "/my/directory" 

for example add current directory (where source file is) load path:

$:.unshift file.expand_path(file.dirname(__file__)) 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -