You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# File actionpack/lib/action_view/helpers/capture_helper.rb, line 38defcapture(*args)value=nilbuffer=with_output_buffer{value=yield(*args)}ifstring=buffer.presence || valueandstring.is_a?(String)ERB::Util.html_escapestringendend
Let's say I have a block that includes JSON, like if I call #to_json on a Hash, and pass that into capture. Then, that string gets #html_escape'd TWICE. The result is impossible to deal with once you get a few layers into it. Should capture take a option[:no_escape]? Or, have an entirely separate method to call, like, #capture_without_escaping? The latter approach is what I've been doing in the ApplicationHelper of my applications. I'd write a patch file, just want to hear some thoughts on a best-practice for this.
The text was updated successfully, but these errors were encountered:
Imported from Lighthouse.
Comment by tonycoco - 2011-02-02 00:59:41 UTC
Upon further review of the newest Rails code. The capture method works as advertised. I'll continue to look at it, but I think this one can be closed out.
Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6313
Created by tonycoco - 2011-02-22 17:42:04 UTC
A quick look at the current code for reference...
Let's say I have a block that includes JSON, like if I call #to_json on a Hash, and pass that into capture. Then, that string gets #html_escape'd TWICE. The result is impossible to deal with once you get a few layers into it. Should capture take a option[:no_escape]? Or, have an entirely separate method to call, like, #capture_without_escaping? The latter approach is what I've been doing in the ApplicationHelper of my applications. I'd write a patch file, just want to hear some thoughts on a best-practice for this.
The text was updated successfully, but these errors were encountered: