diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2012-10-01 19:52:52 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-10-01 19:52:52 -0700 |
commit | 037e50ec39c7c3d58a102a6584e2740652420d1d (patch) | |
tree | 17dfc52c9192db2cf6b79a77df7a15260527fa4c /railties/lib/rails/application.rb | |
parent | f934aecf61cd2c5df8a598fbddc83516f92d96c0 (diff) | |
parent | f4a6f1d3f0d7ec2eb7a779a74f587cb953992ea8 (diff) | |
download | rails-037e50ec39c7c3d58a102a6584e2740652420d1d.tar.gz rails-037e50ec39c7c3d58a102a6584e2740652420d1d.tar.bz2 rails-037e50ec39c7c3d58a102a6584e2740652420d1d.zip |
Merge pull request #7794 from guilleiguaran/extract-rack-cache
Use Rack::Cache middleware only if is in Gemfile
Diffstat (limited to 'railties/lib/rails/application.rb')
-rw-r--r-- | railties/lib/rails/application.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 050190cba6..0b9ed025db 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -282,6 +282,12 @@ module Rails ActionDispatch::MiddlewareStack.new.tap do |middleware| app = self if rack_cache = config.action_controller.perform_caching && config.action_dispatch.rack_cache + begin + require 'rack/cache' + rescue LoadError => error + error.message << ' Be sure to add rack-cache to your Gemfile' + raise + end require "action_dispatch/http/rack_cache" middleware.use ::Rack::Cache, rack_cache end |