In Rails, you can create a model under app/foo/bar.rb , where bar.rb contains:
class Foo::Bar def some_method puts "I work fine" end end
If you try to do this in a pure ruby ββapplication, you will get NameError: uninitialized constant Foo if you have not initialized the Foo module.
What does Rails do that allow you to create classes without first initializing their containing module? Is it possible to import this behavior through something like activesupport, or have we left it on our own?
source share