diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-10 10:22:09 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-10 10:22:09 +0200 |
commit | 86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9 (patch) | |
tree | 886a43eb4d2b590b13e4dec43b500022e7112448 /actionpack/lib/action_view | |
parent | 3f36441e90d0930349186ca597c9884ff1d7fbdb (diff) | |
download | rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.tar.gz rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.tar.bz2 rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.zip |
Add tests for content_for() for read, closes #475.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/capture_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index ead7feb091..3b5f4e694f 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -135,8 +135,12 @@ module ActionView # for elements that will be fragment cached. def content_for(name, content = nil, &block) content = capture(&block) if block_given? - result = @view_flow.append(name, content) if content - result unless content + if content + @view_flow.append(name, content) + nil + else + @view_flow.get(name) + end end # The same as +content_for+ but when used with streaming flushes |