Change documentation of metal anonymous class
Make it clearer [ci skip]
This commit is contained in:
parent
cb2d671cb8
commit
e9f06b2ac1
|
@ -3,11 +3,16 @@ require "action_controller/log_subscriber"
|
|||
require "action_controller/metal/params_wrapper"
|
||||
|
||||
module ActionController
|
||||
# The <tt>metal</tt> anonymous class is simple workaround the ordering issues there are with modules.
|
||||
# They need to be included in specific order which makes it impossible for 3rd party libs (like ActiveRecord)
|
||||
# to hook up with its own functionality. Having anonymous super class type of Metal with <tt>AbstractController::Rendering</tt>
|
||||
# included, allows us to include <tt>ActionView::Rendering</tt> (which implements <tt>AbstractController::Rendering</tt> interface)
|
||||
# after the <tt>AbstractController::Rendering</tt> and before <tt>ActionController::Rendering</tt>.
|
||||
# The <tt>metal</tt> anonymous class was introduced to solve issue with including modules in <tt>ActionController::Base</tt>.
|
||||
# Modules needes to be included in particluar order. First wee need to have <tt>AbstractController::Rendering</tt> included,
|
||||
# next we should include actuall implementation which would be for example <tt>ActionView::Rendering</tt> and after that
|
||||
# <tt>ActionController::Rendering</tt>. This order must be preserved and as we want to have middle module included dynamicaly
|
||||
# <tt>metal</tt> class was introduced. It has <tt>AbstractController::Rendering</tt> included and is parent class of
|
||||
# <tt>ActionController::Base</tt> which includes <tt>ActionController::Rendering</tt>. If we include <tt>ActionView::Rendering</tt>
|
||||
# beetween them to perserve the required order, we can simply do this by:
|
||||
#
|
||||
# ActionController::Base.superclass.send(:include, ActionView::Rendering)
|
||||
#
|
||||
metal = Class.new(Metal) do
|
||||
include AbstractController::Rendering
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue