Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch '3-0-9' of github.com:rails/rails into 3-0-9

* '3-0-9' of github.com:rails/rails:
  Make sure that we don't perform in-place mutation on SafeBuffer string
  Update CHANGELOG to mention the json_escape change
  Ensure number helpers can handle HTML safe strings - closes #1597.
  • Loading branch information...
commit d9584284c242e9fa5fea28035bee85890c395f30 2 parents f283194 + f169dab
@tenderlove tenderlove authored
View
3  actionpack/lib/action_view/template.rb
@@ -192,6 +192,9 @@ def compile(locals, view, mod)
locals_code = locals.keys.map! { |key| "#{key} = local_assigns[:#{key}];" }.join
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
5 actionpack/test/template/template_test.rb
@@ -128,5 +128,10 @@ def with_external_encoding(encoding)
ensure
Encoding.default_external = old
end
+
+ def test_render_inline_safebuffer_should_not_raise_error
+ @template = new_template("Hello".html_safe)
+ render
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.