diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2016-03-05 00:41:10 -0500 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2016-03-05 00:41:10 -0500 |
commit | 3d6c124dc1e2911b45c23596e9f0e1d2d7ee615f (patch) | |
tree | 8777a4ff661241857d46b51f52ae05a83efa5986 | |
parent | 225bd148232a970174736ab5448eca42a696670f (diff) | |
download | rails-3d6c124dc1e2911b45c23596e9f0e1d2d7ee615f.tar.gz rails-3d6c124dc1e2911b45c23596e9f0e1d2d7ee615f.tar.bz2 rails-3d6c124dc1e2911b45c23596e9f0e1d2d7ee615f.zip |
Remove http_cache_forever's version parameter
-rw-r--r-- | actionpack/lib/action_controller/metal/conditional_get.rb | 6 | ||||
-rw-r--r-- | actionpack/test/controller/render_test.rb | 10 |
2 files changed, 3 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb index e2535d024c..35befc05e1 100644 --- a/actionpack/lib/action_controller/metal/conditional_get.rb +++ b/actionpack/lib/action_controller/metal/conditional_get.rb @@ -222,12 +222,10 @@ module ActionController # * +public+: By default, HTTP responses are private, cached only on the # user's web browser. To allow proxies to cache the response, set +true+ to # indicate that they can serve the cached response to all users. - # - # * +version+: the version passed as a key for the cache. - def http_cache_forever(public: false, version: 'v1') + def http_cache_forever(public: false) expires_in 100.years, public: public - yield if stale?(etag: "#{version}-#{request.fullpath}", + yield if stale?(etag: request.fullpath, last_modified: Time.new(2011, 1, 1).utc, public: public) end diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index b7f3e121fd..82fc8b0f8a 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -703,7 +703,7 @@ end class HttpCacheForeverTest < ActionController::TestCase class HttpCacheForeverController < ActionController::Base def cache_me_forever - http_cache_forever(public: params[:public], version: params[:version] || 'v1') do + http_cache_forever(public: params[:public]) do render plain: 'hello' end end @@ -742,13 +742,5 @@ class HttpCacheForeverTest < ActionController::TestCase assert_response :not_modified @request.if_modified_since = @response.headers['Last-Modified'] @request.if_none_match = @response.etag - - get :cache_me_forever, params: {version: 'v2'} - assert_response :success - @request.if_modified_since = @response.headers['Last-Modified'] - @request.if_none_match = @response.etag - - get :cache_me_forever, params: {version: 'v2'} - assert_response :not_modified end end |