[Haml] Allow Haml::Util.html_safe to take nil.
This commit is contained in:
parent
3e21850960
commit
be8080b271
|
@ -16,6 +16,8 @@
|
|||
|
||||
* Make loading the gemspec not crash on read-only filesystems like Heroku's.
|
||||
|
||||
* Don't crash when methods like `form_for` return `nil` in, for example, Rails 3 beta.
|
||||
|
||||
## 2.2.21
|
||||
|
||||
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).
|
||||
|
|
|
@ -210,9 +210,10 @@ module Haml
|
|||
# With older versions of the Rails XSS-safety mechanism,
|
||||
# this destructively modifies the HTML-safety of `text`.
|
||||
#
|
||||
# @param text [String]
|
||||
# @return [String] `text`, marked as HTML-safe
|
||||
# @param text [String, nil]
|
||||
# @return [String, nil] `text`, marked as HTML-safe
|
||||
def html_safe(text)
|
||||
return unless text
|
||||
return text.html_safe if defined?(ActiveSupport::SafeBuffer)
|
||||
text.html_safe!
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue