Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4625274
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:14:54+00:00 2026-05-22T03:14:54+00:00

loadee.rb puts ‘> This is the second file.’ loaddemo.rb puts ‘This is the first

  • 0

loadee.rb

puts '> This is the second file.'

loaddemo.rb

puts 'This is the first (master) program file.'
load 'loadee.rb'
puts 'And back again to the first file.'

When I run "ruby loaddemo.rb", This works fine. Both files are in the same directory, and that’s the directory I run from.

But if I change the load to a require, and with or without the extension I get:

<internal:lib/rubygems/custom_require>:29:in `require': no such file to load
 -- loadee.rb (LoadError)
        from <internal:lib/rubygems/custom_require>:29:in `require'
        from loaddemo.rb:2:in `<main>'

My question is of course, why isn’t require working in this case? It should, right? Do load and require use different paths?

Ruby version 1.9.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:14:55+00:00Added an answer on May 22, 2026 at 3:14 am

    If you provide just a filename to require, it will only look in the predefined $LOAD_PATH directories. However, if you provide a path with your filename, it should work:

    puts 'This is the first (master) program file.'
    require './loadee.rb'
    puts 'And back again to the first file.'
    

    You could also add your project’s folder to the load path instead:

    $LOAD_PATH.unshift File.dirname(__FILE__)
    puts 'This is the first (master) program file.'
    require 'loadee.rb'
    puts 'And back again to the first file.'
    

    And last, you could just use require_relative instead:

    puts 'This is the first (master) program file.'
    require_relative 'loadee.rb'
    puts 'And back again to the first file.'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using The loader class of Adobe Flex, I load an external SWF file. However,
In plain Ruby, this works just fine: class TestSuper def foo puts In TestSuper.foo
I have CSV data loaded into a multidimensional array. In this way each row
Say you've loaded a text file into a string, and you'd like to convert
i would like to load modules dynamically and execute a method for each module
For a Rails app, I would like to overload or modify Kernel::load such that
I'm having this behavior with Doctrine 2.1 where I'm looking for a nice 'workaround'.
I am trying to grab a webpage with actionscript, but keep getting this error
I am using nodejs. And calling something like the following from a javascript file:
I'm loading using $.load() a .aspx page on a div of a parent .aspx,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.