aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-05-02 22:30:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-05-02 22:30:41 +0000
commitedaf6baea72c48dc90af3cb6b0a1078228f85f89 (patch)
treef732f5028453c1cab4800229feed26de9834bf6c /actionpack/lib/action_view/helpers
parent0778464168960a830b806f66a200e86a163a5831 (diff)
downloadrails-edaf6baea72c48dc90af3cb6b0a1078228f85f89.tar.gz
rails-edaf6baea72c48dc90af3cb6b0a1078228f85f89.tar.bz2
rails-edaf6baea72c48dc90af3cb6b0a1078228f85f89.zip
Fixed that content_tag with a block will just return the result instead of concate it if not used in a ERb view #7857, #7432 [michael.niessner]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6652 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/tag_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb
index 0e99cfab65..7c6903220a 100644
--- a/actionpack/lib/action_view/helpers/tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/tag_helper.rb
@@ -48,7 +48,8 @@ module ActionView
if block_given?
options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
content = capture(&block)
- concat(content_tag_string(name, content, options), block.binding)
+ content_tag = content_tag_string(name, content, options)
+ block_is_within_action_view?(block) ? concat(content_tag, block.binding) : content_tag
else
content = content_or_options_with_block
content_tag_string(name, content, options)
@@ -98,6 +99,10 @@ module ActionView
def fix_double_escape(escaped)
escaped.gsub(/&amp;([a-z]+|(#\d+));/i) { "&#{$1};" }
end
+
+ def block_is_within_action_view?(block)
+ eval("defined? _erbout", block.binding)
+ end
end
end
end