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

  • Home
  • SEARCH
  • 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 8845083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:39:06+00:00 2026-06-14T11:39:06+00:00

This is how a typical config/environments/*.rb file begins: MyApp::Application.configure do config.cache_classes = false …

  • 0

This is how a typical config/environments/*.rb file begins:

MyApp::Application.configure do
  config.cache_classes = false
  ...
end

The block passed to configure dereferences the symbol config which is apparently unbound. How does this technically work? The symbols used in a block/Proc/lambda should be bound in the context of its declaration, not left to be resolved in the dynamic scope at the call site.

A related question is, where exactly is the Application.configure method declared? It’s not in either application.rb, engine.rb, or railtie.rb. Maybe if I managed to find this method, I would have found the answer to my main question.

Also related, I have studied the Rails initialization procedure in excruciating detail, and I can’t find even a mention of a config/environments/*.rb file. If I knew how these files were treated by the init procedure, that may shed some light on this.

  • 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-14T11:39:07+00:00Added an answer on June 14, 2026 at 11:39 am

    It’s a method config in Rails::Application in the railties gem in lib/rails/application.rb which returns an instance of Application::Configuration, defined in lib/rails/application/configuration.rb.

    The method configure is contributed to Railtie from the autoloaded module Configurable, lib/rails/railtie/configurable, and is defined as

    def configure(&block)
      class_eval(&block)
    end
    

    which explains why the block that configure accepts can resolve the config symbol. Note that class_eval is another piece of rubyist magic that makes this work: it rebinds the passed-in block’s self symbol to the call site’s class.

    Check the comments in the first file in the Booting Process section, which explains where, how and in what order all this goodness comes from, including how the /config/environments directory is processed.

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

Sidebar

Related Questions

Appname::Application.configure do config.action_mailer.delivery_method = :smtp #typical smtp_settings for gmail account config.action_mailer.smtp_settings = { :address
http://something.com:80/somedir/index.html?type=test;one=onevalue#nose This is typical URI structure my question is what is #nose and how
The typical Python threadpool will have a structure like this one: def run(self): while
Typical jQuery over-use: $('button').click(function() { alert('Button clicked: ' + $(this).attr('id')); }); Which can be
Given some typical search form, I can't construct this form action when submitting a
I would select multiple DOM elements using a typical code such as this: $('#ele1,
I am using the typical validator controls for required fields etc. On this form,
Ok, this seems to be a typical error as of discussing a lot in
I'm using the Provider pattern and Unity. This is the typical provider implementation. I
Had started my typical EE build (using a bootstrapped config) for a client when

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.