Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
ActiveSupport::SafeBuffer#prepend inconsistency #14529
a = "bar" # => "bar" a.prepend "foo" # => "foobar" a # => "foobar" b = "bar".html_safe # => "bar" b.class # => ActiveSupport::SafeBuffer b.prepend "foo" # => "foobar" b # => "bar", expected "foobar"
Do we want
def concat(value) super(maybe_escape(value)) end def prepend(value) super(maybe_escape(value)) end private def maybe_escape(value) if html_safe? && !value.html_safe? ERB::Util.h(value) else value end end
Hmm, I just realised there's actually already
As for visually matching methods, I personally don't think that's particularly confusing -- especially when the very first word of the method body is 'super'... but I'm just thinking out loud. It's up to @rafaelfranca which he prefers. And the one that someone cared enough to make, sure has a certain argument over my bikeshedding.