Permalink
Browse files

Write strings to fragment cache, not outputbuffers

  • Loading branch information...
1 parent 1f6c567 commit 47bc138fc1d9ddafab8e4cf9cac8865f2092c003 @jeremy jeremy committed Mar 12, 2010
@@ -41,7 +41,9 @@ def fragment_for(buffer, name = {}, options = nil, &block) #:nodoc:
else
pos = buffer.length
block.call
- write_fragment(name, buffer[pos..-1], options)
+ content = buffer[pos..-1]
+ content = content.as_str if content.respond_to?(:as_str)
+ write_fragment(name, content, options)
end
else
block.call
@@ -89,8 +89,12 @@ def to_s
self
end
+ def as_str
+ ''.replace(self)
+ end
+
def to_yaml
- "".replace(self).to_yaml
+ as_str.to_yaml
end
end
end

0 comments on commit 47bc138

Please sign in to comment.