aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorYehuda Katz <wycats@Yehuda-Katz.local>2009-12-24 21:49:50 -0800
committerYehuda Katz <wycats@Yehuda-Katz.local>2009-12-24 21:50:18 -0800
commitf3b072189a6a77717f99e38403392a68f5818a49 (patch)
treea8d3e8d3ce07d02e4f645dec2e6fb13ee5396404 /activesupport/lib/active_support/core_ext
parentbaaaf2acaa58748bf9dc49859d1bca3ed273dc65 (diff)
downloadrails-f3b072189a6a77717f99e38403392a68f5818a49.tar.gz
rails-f3b072189a6a77717f99e38403392a68f5818a49.tar.bz2
rails-f3b072189a6a77717f99e38403392a68f5818a49.zip
Instead of marking raw text in templates as safe, and then putting them through String#<< which checks if the String is safe, use safe_concat, which uses the original (internal) String#<< and leaves the safe flag as is. Results in a significant performance improvement.
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/string/output_safety.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index a2a88eb7df..9db563f78b 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -23,6 +23,7 @@ class String
end
alias original_concat <<
+ alias safe_concat <<
def <<(other)
result = original_concat(other)
unless html_safe? && also_html_safe?(other)