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 8433847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:29:58+00:00 2026-06-10T06:29:58+00:00

I want to require a file called config.rb in a different ruby file called

  • 0

I want to require a file called config.rb in a different ruby file called basics.rb. I’m using Sinatra as my web framework. I’m sure there’s a way to do this, I just can’t find anything in the docs.

Hopefully it would look something like

post '/' do
  require 'config.rb'
  // logic
end
  • 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-06-10T06:30:00+00:00Added an answer on June 10, 2026 at 6:30 am

    If config.rb is in your load path, you can require it at the top of your basics.rb file with require 'config'. If it is not in your load path, you’ll need something like require '/path/to/your/config'.

    The code you’ve posted will require the file. But only when someone POSTs to ‘/’.

    Also, it’s normal to omit the .rb extension when requiring ruby files. But you can include it if you like.

    You can view your load path by inspecting the global variable $LOAD_PATH. From the command line ruby -e 'puts $LOAD_PATH' will print it for your version of ruby. You can also add directories to your load path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I require different behavior from ActiveRecord::AttributeAssignment.assign_attributes(new_attributes, options). For my entire web application, I want
I want to change the logging level of an application (ruby). require 'logger' config
Hi I want to parse an excel file using zend framework. I went to
If I have a file called test1.lua function print_hi() print(hi) end and I want
I want to play around with three similar Ruby gems called 'yahoofinance' 'yahoo-finance' and
I've registered a control in my web.config file and the .dll for the control
Is there any way, from a PHP script called from mod_php with apache, to
I have a single PHP file that i require in many different php files.
I don't want to file an issue, as I'm not at all sure (and
So I have a file called 'clears' and I want to see if a

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.