Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify content_for implementation

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1914 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 3ccea931fac2872ffb26014592c036b5d137655f 1 parent 852e5a4
@dhh dhh authored
Showing with 2 additions and 10 deletions.
  1. +2 −10 actionpack/lib/action_view/helpers/capture_helper.rb
View
12 actionpack/lib/action_view/helpers/capture_helper.rb
@@ -81,17 +81,9 @@ def capture(*args, &block)
#
# NOTE: Beware that content_for is ignored in caches. So you shouldn't use it
# for elements that are going to be fragment cached.
- def content_for(name, &block)
- base = instance_variable_get(instance_var_name(name)) || ""
- data = capture(&block)
- instance_variable_set(instance_var_name(name), base + data)
- data
+ def content_for(name, &block)
+ eval "@content_for_#{name} = (@content_for_#{name} || '') + capture(&block)"
end
-
- private
- def instance_var_name(name) #:nodoc#
- "@content_for_#{name}"
- end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.