diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 15:27:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-24 15:27:47 +0000 |
commit | 3ccea931fac2872ffb26014592c036b5d137655f (patch) | |
tree | 1e7bfc548ae022ff15bf308c7333a50d2f1fb16f /actionpack/lib/action_view/helpers | |
parent | 852e5a435de6413785b21fdbf6ba6175a0bc09f3 (diff) | |
download | rails-3ccea931fac2872ffb26014592c036b5d137655f.tar.gz rails-3ccea931fac2872ffb26014592c036b5d137655f.tar.bz2 rails-3ccea931fac2872ffb26014592c036b5d137655f.zip |
Simplify content_for implementation
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1914 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index d430121b04..5c1f32a96c 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -81,17 +81,9 @@ module ActionView # # 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 |