提交 f410c13b 编写于 作者: C Carlos Antonio da Silva

Refactor cache fragment handling with read/write methods

上级 f341acda
......@@ -176,14 +176,14 @@ def fragment_name_with_digest(name) #:nodoc:
# TODO: Create an object that has caching read/write on it
def fragment_for(name = {}, options = nil, &block) #:nodoc:
if fragment = controller.read_fragment(name, options)
fragment
else
write_fragment_for(name, options, &block)
end
read_fragment_for(name, options) || write_fragment_for(name, options, &block)
end
def read_fragment_for(name, options) #:nodoc:
controller.read_fragment(name, options)
end
def write_fragment_for(name = {}, options = nil, &block) #:nodoc:
def write_fragment_for(name, options) #:nodoc:
# VIEW TODO: Make #capture usable outside of ERB
# This dance is needed because Builder can't use capture
pos = output_buffer.length
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册