diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-02 11:23:45 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-04-02 11:23:45 -0300 |
commit | 821f968726617b24340c368f025a78adff731a8f (patch) | |
tree | 711bc6ed7936f5796044b025f121c2e236a2090f /activesupport/lib | |
parent | 3bcc51a4af9fd129f7d4f96ef1a053a36063a040 (diff) | |
parent | 848289589edb74767cb97de9ed37a545a8d8b901 (diff) | |
download | rails-821f968726617b24340c368f025a78adff731a8f.tar.gz rails-821f968726617b24340c368f025a78adff731a8f.tar.bz2 rails-821f968726617b24340c368f025a78adff731a8f.zip |
Merge pull request #14529 from rwz/master
ActiveSupport::SafeBuffer#prepend inconsistency
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/output_safety.rb | 15 |
1 files changed, 9 insertions, 6 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 eb02b6a442..85cc75ff9a 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -124,7 +124,7 @@ module ActiveSupport #:nodoc: class SafeBuffer < String UNSAFE_STRING_METHODS = %w( capitalize chomp chop delete downcase gsub lstrip next reverse rstrip - slice squeeze strip sub succ swapcase tr tr_s upcase prepend + slice squeeze strip sub succ swapcase tr tr_s upcase ) alias_method :original_concat, :concat @@ -169,15 +169,18 @@ module ActiveSupport #:nodoc: self[0, 0] end - def concat(value) - if !html_safe? || value.html_safe? - super(value) - else - super(ERB::Util.h(value)) + %w[concat prepend].each do |method_name| + define_method method_name do |value| + super(html_escape_interpolated_argument(value)) end end alias << concat + def prepend!(value) + ActiveSupport::Deprecation.deprecation_warning "ActiveSupport::SafeBuffer#prepend!", :prepend + prepend value + end + def +(other) dup.concat(other) end |