But there’s still no: include ActionController::Layout::ClassMethods.
Nope. But in action_controller/layout.rb there is:
module ActionController #:nodoc:
module Layout #:nodoc:
HOW DO YOU KNOW, BOTTOM LINE, AFTER ALL THE VARIOUS FILES ARE
CONSIDERED, WHAT A CLASS DOES?
A few choices:
- At runtime, ask it:
Loading development environment.
Trust the author(s) of the code to write sufficient documentation
that explains to you all you need to know.
Read the source code.
I realize that none of these are ideal for huge projects like rails. I’m
not claiming that they are, I’m just laying out some options.
I still don’t know how ApplicationController::Base can call
layout(). I still can’t understand why it’s not in the doc as common
Hopefully you now understand why it can call layout. To recap:
Why it’s not in the documentation is because:
- RDoc was not smart enough to figure out that the end result of all
those runtime calls would always include ClassMethods methods as methods
of the ActionController::Base class.
- Nobody writing the documentation for rails noticed this omission and
wrote additional explanatory code letting you know that all the methods
from ActionController::Layout::ClassMethods are available inside