Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid extra call to Cache#read in case of a fragment cache hit

  • Loading branch information...
commit e54d9c1eb758d7f6f13f699e097c9f07a54d4970 1 parent 0ed8dea
@guilleiguaran guilleiguaran authored
View
4 actionpack/lib/action_view/helpers/cache_helper.rb
@@ -46,8 +46,8 @@ def cache(name = {}, options = nil, &block)
private
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
- if controller.fragment_exist?(name, options)
- controller.read_fragment(name, options)
+ if fragment = controller.read_fragment(name, options)
+ fragment
else
# VIEW TODO: Make #capture usable outside of ERB
# This dance is needed because Builder can't use capture
View
2  actionpack/test/controller/log_subscriber_test.rb
@@ -153,7 +153,7 @@ def test_with_fragment_cache
wait
assert_equal 4, logs.size
- assert_match /Exist fragment\? views\/foo/, logs[1]
+ assert_match /Read fragment views\/foo/, logs[1]
assert_match /Write fragment views\/foo/, logs[2]
ensure
@controller.config.perform_caching = true
Please sign in to comment.
Something went wrong with that request. Please try again.