require file use dirname(__FILE__) or just requre filename?
Posted
by user285020
on Stack Overflow
See other posts from Stack Overflow
or by user285020
Published on 2010-05-28T07:41:06Z
Indexed on
2010/05/28
7:51 UTC
Read the original article
Hit count: 172
I have a file at lib directory in my rails project. like this a (directory) a1 a2 a.rb
when I in a.rb require a1.
require 'a/a1'
it will warn me /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- a/a1 (MissingSourceFile)
but use dirname(FILE), it work.
require File.dirname(__FILE__) + '/a/a1
why?
© Stack Overflow or respective owner