Merge pull request #1641 from sikachu/3-1-stable-render-inline

Render inline fix for 3-1-stable
This commit is contained in:
Aaron Patterson
2011-06-10 16:28:06 -07:00
3 changed files with 10 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
*Rails 3.1.0 (unreleased)*
* json_escape will now return a SafeBuffer string if it receives SafeBuffer string [tenderlove]
* Make sure escape_js returns SafeBuffer string if it receives SafeBuffer string [Prem Sichanugrist]
* Fix escape_js to work correctly with the new SafeBuffer restriction [Paul Gallagher]

View File

@@ -219,6 +219,9 @@ module ActionView
method_name = self.method_name
if source.encoding_aware?
# Avoid performing in-place mutation for SafeBuffer
@source = source.to_str if source.html_safe?
# Look for # encoding: *. If we find one, we'll encode the
# String in that encoding, otherwise, we'll use the
# default external encoding.

View File

@@ -173,5 +173,10 @@ class TestERBTemplate < ActiveSupport::TestCase
ensure
silence_warnings { Encoding.default_external = old }
end
def test_render_inline_safebuffer_should_not_raise_error
@template = new_template("Hello".html_safe)
render
end
end
end