For example, you see files called
which adds methods and such to the open module ActionController. What
scope is ActionController in? Is it just called the global scope?
Obviously, there is namespace resolution lookup. And a good example of
this is in the Base class of the same file. It references one module
like this: AbstractController::Layouts and another module like this:
Rendering. One uses the :: namespace resolution operator, because
Layouts module is not within the scope that class Base is, which is
module ActionController scope, so it has to reference
AbstractController which must be in the GLOBAL scope in order for ruby
to find it and then it can look there to find Layouts. In contrast,
Rendering is defined within the ActionController scope, and since
class Base is defined within the ActionController scope as well, it
doesn’t need to use the :: operator. It can simply search within that
scope and find the module Rendering. So what is that global scope that
ActionController and AbstractController are in within Rails?