# Re: Partial Resolution?

**URL:** <https://www.ruby-forum.com/t/re-partial-resolution/72801>\
**Category:** Ruby\
**Created:** [October 19, 2006, 1:05am UTC](https://www.ruby-forum.com/t/re-partial-resolution/72801 "2006-10-19T01:05:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 19, 2006, 1:05am UTC](https://www.ruby-forum.com/t/re-partial-resolution/72801/1 "2006-10-19T01:05:50Z")

</div>

From: removed\_email\_address@domain.invalid [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> But there’s still no: include ActionController::Layout::ClassMethods.

Nope. But in action\_controller/layout.rb there is:  
module ActionController #:nodoc:  
module Layout #:nodoc:  
def self.included(base)  
base.extend(ClassMethods)  
[…snip…]  
end  
end  
end

> HOW DO YOU KNOW, BOTTOM LINE, AFTER ALL THE VARIOUS FILES ARE  
> CONSIDERED, WHAT A CLASS DOES?

A few choices:

1. At runtime, ask it:  
C:.…\site\>ruby script\console  
Loading development environment.

> > puts ActionController::Base.methods.sort  
> > \<  
> > \<=  
> > \<=\>  
> > ==  
> > ===  
> > =~
> 
> =  
> **id**  
> […snip…]  
> layout  
> layout\_conditions  
> load  
> […snip…]

1. Trust the author(s) of the code to write sufficient documentation  
that explains to you all you need to know.

2. 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  
> sense demands.

Hopefully you now understand why it can call layout. To recap:

ActionController::Base.class\_eval do  
include ActionController::Layout  
end  
…  
module ActionController::Layout  
def self.included(base)  
base.extend(ClassMethods)  
end  
end

Why it’s not in the documentation is because:

1. 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.  
and
2. 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  
ActionController::Base.
