diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-13 08:49:05 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2019-02-13 10:35:28 -0800 |
commit | bfcdd46614407d6bf1c955aad6ed4aa3094d2189 (patch) | |
tree | c51e9c35dd81749f674f69623187cbe1ae096b84 /actionview/test | |
parent | 38f9e41f2c4b64377ffb036c53873dbfb51546cf (diff) | |
download | rails-bfcdd46614407d6bf1c955aad6ed4aa3094d2189.tar.gz rails-bfcdd46614407d6bf1c955aad6ed4aa3094d2189.tar.bz2 rails-bfcdd46614407d6bf1c955aad6ed4aa3094d2189.zip |
Cached collections only work if there is one template
Cached collections only work if there is one template. If there are
more than one templates, the caching mechanism doesn't have a key.
Diffstat (limited to 'actionview/test')
-rw-r--r-- | actionview/test/template/render_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/actionview/test/template/render_test.rb b/actionview/test/template/render_test.rb index 3f298d81f3..e6e80bc1b8 100644 --- a/actionview/test/template/render_test.rb +++ b/actionview/test/template/render_test.rb @@ -752,6 +752,17 @@ class CachedCollectionViewRenderTest < ActiveSupport::TestCase @view.render(partial: "test/cached_customer", collection: [customer], cached: true) end + test "collection caching does not work on multi-partials" do + a = Object.new + b = Object.new + def a.to_partial_path; "test/partial_iteration_1"; end + def b.to_partial_path; "test/partial_iteration_2"; end + + assert_raises(NotImplementedError) do + @controller_view.render(partial: [a, b], cached: true) + end + end + private def cache_key(*names, virtual_path) digest = ActionView::Digestor.digest name: virtual_path, finder: @view.lookup_context, dependencies: [] |