Browse files

Alias << as append= for ActiveSupport::SafeBuffer to fix "undefined m…

…ethod `append='" error with fragment cache helper on cache miss introduced with 03d01ec.

Since 03d01ec fragment_for sets the output_buffer to a SafeBuffer. ERB expects append= to be defined on the output_buffer.
This means subsequent ERB tags would cause an "undefined method `append='" error.
  • Loading branch information...
1 parent b6cf638 commit 9f7e7754053f06a6c51550a2ecd03e4fed9aeea2 @kommen committed Jul 19, 2011
View
1 actionpack/test/controller/caching_test.rb
@@ -742,6 +742,7 @@ def test_fragment_caching
expected_body = <<-CACHED
Hello
This bit's fragment cached
+Ciao
CACHED
assert_equal expected_body, @response.body
View
1 actionpack/test/fixtures/functional_caching/fragment_cached.html.erb
@@ -1,2 +1,3 @@
Hello
<%= cache do %>This bit's fragment cached<% end %>
+<%= 'Ciao' %>
View
1 activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -109,6 +109,7 @@ def concat(value)
end
end
alias << concat
+ alias :append= :concat
def +(other)
dup.concat(other)

0 comments on commit 9f7e775

Please sign in to comment.