提交 96cca7db 编写于 作者: J Jeremy Kemper

ActionView::Base.erb_variable accessor names the buffer variable used to...

ActionView::Base.erb_variable accessor names the buffer variable used to render templates. Defaults to _erbout; use _buf for erubis.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5544 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 495f113e
*SVN* *SVN*
* Deprecate standalone components. [Jeremy Kemper] * ActionView::Base.erb_variable accessor names the buffer variable used to render templates. Defaults to _erbout; use _buf for erubis. [Rick Olson]
* assert_select_rjs :remove. [Dylan Egan] * assert_select_rjs :remove. [Dylan Egan]
......
...@@ -330,7 +330,7 @@ def fragment_cache_key(name) ...@@ -330,7 +330,7 @@ def fragment_cache_key(name)
def cache_erb_fragment(block, name = {}, options = nil) def cache_erb_fragment(block, name = {}, options = nil)
unless perform_caching then block.call; return end unless perform_caching then block.call; return end
buffer = eval("_erbout", block.binding) buffer = eval(ActionView::Base.erb_variable, block.binding)
if cache = read_fragment(name, options) if cache = read_fragment(name, options)
buffer.concat(cache) buffer.concat(cache)
......
...@@ -183,6 +183,9 @@ class Base ...@@ -183,6 +183,9 @@ class Base
# that alert()s the caught exception (and then re-raises it). # that alert()s the caught exception (and then re-raises it).
@@debug_rjs = false @@debug_rjs = false
cattr_accessor :debug_rjs cattr_accessor :debug_rjs
@@erb_variable = '_erbout'
cattr_accessor :erb_variable
@@template_handlers = HashWithIndifferentAccess.new @@template_handlers = HashWithIndifferentAccess.new
......
...@@ -56,15 +56,15 @@ module CaptureHelper ...@@ -56,15 +56,15 @@ module CaptureHelper
def capture(*args, &block) def capture(*args, &block)
# execute the block # execute the block
begin begin
buffer = eval("_erbout", block.binding) buffer = eval(ActionView::Base.erb_variable, block.binding)
rescue rescue
buffer = nil buffer = nil
end end
if buffer.nil? if buffer.nil?
capture_block(*args, &block) capture_block(*args, &block).to_s
else else
capture_erb_with_buffer(buffer, *args, &block) capture_erb_with_buffer(buffer, *args, &block).to_s
end end
end end
...@@ -99,7 +99,7 @@ def capture_block(*args, &block) ...@@ -99,7 +99,7 @@ def capture_block(*args, &block)
end end
def capture_erb(*args, &block) def capture_erb(*args, &block)
buffer = eval("_erbout", block.binding) buffer = eval(ActionView::Base.erb_variable, block.binding)
capture_erb_with_buffer(buffer, *args, &block) capture_erb_with_buffer(buffer, *args, &block)
end end
......
...@@ -23,7 +23,7 @@ module TextHelper ...@@ -23,7 +23,7 @@ module TextHelper
# is equivalent to using: # is equivalent to using:
# <%= "hello" %> # <%= "hello" %>
def concat(string, binding) def concat(string, binding)
eval("_erbout", binding).concat(string) eval(ActionView::Base.erb_variable, binding) << string
end end
# If +text+ is longer than +length+, +text+ will be truncated to the length of # If +text+ is longer than +length+, +text+ will be truncated to the length of
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册