From f3b072189a6a77717f99e38403392a68f5818a49 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Thu, 24 Dec 2009 21:49:50 -0800 Subject: 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. --- activesupport/lib/active_support/core_ext/string/output_safety.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/lib/active_support/core_ext') 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) -- cgit v1.2.3