diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-02-23 19:55:49 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-02-23 21:11:15 -0300 |
commit | 40fa818580a9277d8d1a02241f1422dbf83a8aa1 (patch) | |
tree | 132e765683020927e21d920673a38b3220852c03 /actionpack/lib | |
parent | 3d7b0d480467b17715941503b1fe598e57c13ac1 (diff) | |
download | rails-40fa818580a9277d8d1a02241f1422dbf83a8aa1.tar.gz rails-40fa818580a9277d8d1a02241f1422dbf83a8aa1.tar.bz2 rails-40fa818580a9277d8d1a02241f1422dbf83a8aa1.zip |
Move Caching module to Abstract Controller
Abstract Controller is the common component between Action Mailer and
Action Controller so if we need to share the caching component it need
to be there.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/abstract_controller/caching.rb (renamed from actionpack/lib/action_dispatch/caching.rb) | 10 | ||||
-rw-r--r-- | actionpack/lib/abstract_controller/caching/fragments.rb (renamed from actionpack/lib/action_dispatch/caching/fragments.rb) | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller.rb | 10 | ||||
-rw-r--r-- | actionpack/lib/action_controller/caching.rb | 4 |
5 files changed, 18 insertions, 14 deletions
diff --git a/actionpack/lib/abstract_controller.rb b/actionpack/lib/abstract_controller.rb index 56c4033387..1e57cbaac4 100644 --- a/actionpack/lib/abstract_controller.rb +++ b/actionpack/lib/abstract_controller.rb @@ -6,6 +6,7 @@ module AbstractController extend ActiveSupport::Autoload autoload :Base + autoload :Caching autoload :Callbacks autoload :Collector autoload :DoubleRenderError, "abstract_controller/rendering" @@ -15,4 +16,9 @@ module AbstractController autoload :Translation autoload :AssetPaths autoload :UrlFor + + def self.eager_load! + super + AbstractController::Caching.eager_load! + end end diff --git a/actionpack/lib/action_dispatch/caching.rb b/actionpack/lib/abstract_controller/caching.rb index 4e38098541..0dea50889a 100644 --- a/actionpack/lib/action_dispatch/caching.rb +++ b/actionpack/lib/abstract_controller/caching.rb @@ -1,10 +1,12 @@ -require 'action_dispatch/caching/fragments' - -module ActionDispatch +module AbstractController module Caching extend ActiveSupport::Concern extend ActiveSupport::Autoload + eager_autoload do + autoload :Fragments + end + module ConfigMethods def cache_store config.cache_store @@ -21,7 +23,7 @@ module ActionDispatch end include ConfigMethods - include ActionDispatch::Caching::Fragments + include AbstractController::Caching::Fragments included do extend ConfigMethods diff --git a/actionpack/lib/action_dispatch/caching/fragments.rb b/actionpack/lib/abstract_controller/caching/fragments.rb index dcc490776e..3257a731ed 100644 --- a/actionpack/lib/action_dispatch/caching/fragments.rb +++ b/actionpack/lib/abstract_controller/caching/fragments.rb @@ -1,4 +1,4 @@ -module ActionDispatch +module AbstractController module Caching # Fragment caching is used for caching various blocks within # views without caching the entire action as a whole. This is diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index 40f33a9de0..62f5905205 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -9,12 +9,15 @@ module ActionController autoload :API autoload :Base - autoload :Caching autoload :Metal autoload :Middleware autoload :Renderer autoload :FormBuilder + eager_autoload do + autoload :Caching + end + autoload_under "metal" do autoload :ConditionalGet autoload :Cookies @@ -47,11 +50,6 @@ module ActionController autoload :TestCase, 'action_controller/test_case' autoload :TemplateAssertions, 'action_controller/test_case' - - def self.eager_load! - super - ActionController::Caching.eager_load! - end end # Common Active Support usage in Action Controller diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index ff3678d952..9df4ab6c7a 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -1,5 +1,3 @@ -require 'action_dispatch/caching' - module ActionController # \Caching is a cheap way of speeding up slow applications by keeping the result of # calculations, renderings, and database calls around for subsequent requests. @@ -26,7 +24,7 @@ module ActionController extend ActiveSupport::Concern included do - include ActionDispatch::Caching + include AbstractController::Caching end def instrument_payload(key) |