Fixed no-binding fragment caching

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@473 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 7306675f
......@@ -247,10 +247,10 @@ def self.append_features(base) #:nodoc:
end
# Called by CacheHelper#cache
def cache_erb_fragment(name = {}, options = {}, &block)
def cache_erb_fragment(block, name = {}, options = {})
unless perform_caching then block.call; return end
buffer = eval("_erbout", block)
buffer = eval("_erbout", block.binding)
if cache = read_fragment(name, options)
buffer.concat(cache)
......
......@@ -16,11 +16,11 @@ def initialize_query()
end
private
def multipart_form_boundary
multipart_form_boundary_re = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n # " ruby-mode
MULTIPART_FORM_BOUNDARY_RE = %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n
def multipart_form_boundary
if env_table['REQUEST_METHOD'] == 'POST'
multipart_form_boundary_re.match(env_table['CONTENT_TYPE']).to_a.pop
MULTIPART_FORM_BOUNDARY_RE.match(env_table['CONTENT_TYPE']).to_a.pop
end
end
......
......@@ -2,8 +2,8 @@ module ActionView
module Helpers
# See ActionController::Caching::Fragments for usage instructions.
module CacheHelper
def cache(name = {})
@controller.cache_erb_fragment(binding, name) { yield }
def cache(name = {}, &block)
@controller.cache_erb_fragment(block, name)
end
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册