Require command

Hello
I am using ruby192 and when ever i use "require" to load another saved
module it doesn't work how ever "load" works perfectly
Why is that? How can i fix this? and will this affect my code when i
start using gems?
Thanks

···

--
Posted via http://www.ruby-forum.com/.

Well, typically it's:

require "some_file"

and

load "some_file.rb"

Also, know that require only pulls the file in the first time, while load will read (and execute) the source file every time.

-Rob

Rob Biedenharn
Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/
rab@GaslightSoftware.com http://GaslightSoftware.com/

···

On Sep 20, 2011, at 3:14 PM, Aya Abdelsalam wrote:

Hello
I am using ruby192 and when ever i use "require" to load another saved
module it doesn't work how ever "load" works perfectly
Why is that? How can i fix this? and will this affect my code when i
start using gems?
Thanks

--

Well I tried that it still doesn't work here is the error message it
generates:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to
load -- account (LoadError)
  from <internal:lib/rubygems/custom_require>:29:in `require'
  from test_libraries.rb:1:in `<main>'

···

--
Posted via http://www.ruby-forum.com/.

Hello
I am using ruby192 and when ever i use "require" to load another saved
module it doesn't work how ever "load" works perfectly
Why is that?

Probably because you are trying to require a file in or from within
(via "my/file/path") the current working directory (aka '.')

How can i fix this?

require_relative "my_file"
require_relative "my/file/path"

and will this affect my code when i
start using gems?

Gems are in the gem search path of RubyGems, so: No, it won't.

···

On Tue, Sep 20, 2011 at 9:14 PM, Aya Abdelsalam <ayoya_91@hotmail.com> wrote:

--
Phillip Gawlowski

gplus.to/phgaw | twitter.com/phgaw

A method of solution is perfect if we can forsee from the start,
and even prove, that following that method we shall attain our aim.
-- Leibniz

require_relative "my_file" Works just fine!!
Thank you Phillip for your help :slight_smile:

···

--
Posted via http://www.ruby-forum.com/.