Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid extra call to Cache#read in case of a fragment cache hit (3-0-stable) #1896

Merged
merged 1 commit into from
Jun 29, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions actionpack/lib/action_view/helpers/cache_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/log_subscriber_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down