mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Use Rack::Cache middleware only if is in Gemfile
This commit is contained in:
parent
f655108c26
commit
cbd26a803b
3 changed files with 7 additions and 1 deletions
1
Gemfile
1
Gemfile
|
@ -6,6 +6,7 @@ gem 'arel', github: 'rails/arel', branch: 'master'
|
|||
|
||||
gem 'mocha', '>= 0.11.2', :require => false
|
||||
gem 'rack-test', github: 'brynary/rack-test'
|
||||
gem 'rack-cache', "~> 1.2"
|
||||
gem 'bcrypt-ruby', '~> 3.0.0'
|
||||
gem 'jquery-rails'
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ Gem::Specification.new do |s|
|
|||
s.requirements << 'none'
|
||||
|
||||
s.add_dependency('activesupport', version)
|
||||
s.add_dependency('rack-cache', '~> 1.2')
|
||||
s.add_dependency('builder', '~> 3.1.0')
|
||||
s.add_dependency('rack', '~> 1.4.1')
|
||||
s.add_dependency('rack-test', '~> 0.6.1')
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue