diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-07-25 14:02:17 +0200 |
---|---|---|
committer | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-08-25 11:39:11 +0200 |
commit | e9f06b2ac151be1957395076f55cbfa9979bf2a5 (patch) | |
tree | 10c8de4cd61bcaa9b905f3380817972003780c71 /actionpack/lib | |
parent | cb2d671cb884a7cfeb991ce5af5d7e1047685dbd (diff) | |
download | rails-e9f06b2ac151be1957395076f55cbfa9979bf2a5.tar.gz rails-e9f06b2ac151be1957395076f55cbfa9979bf2a5.tar.bz2 rails-e9f06b2ac151be1957395076f55cbfa9979bf2a5.zip |
Change documentation of metal anonymous class
Make it clearer
[ci skip]
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index ff0a7bf6ce..dc880cd866 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -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 |