Skip to content

Commit

Permalink
Merge pull request #1639 from sikachu/3-0-stable-render-inline
Browse files Browse the repository at this point in the history
Render inline fix for 3-0-stable
  • Loading branch information
tenderlove committed Jun 10, 2011
2 parents 9b80f8d + 104e200 commit 70b4ea9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*Rails 3.0.9 (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 text helpers to work correctly with the new SafeBuffer restriction [Paul Gallagher, Arun Agrawal, Prem Sichanugrist]
Expand Down
3 changes: 3 additions & 0 deletions actionpack/lib/action_view/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/template/template_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 70b4ea9

Please sign in to comment.