1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Haml] Work around the Rails on_load bug.

Closes gh-142
This commit is contained in:
Nathan Weizenbaum 2010-04-27 18:11:05 -07:00
parent 9a0583719c
commit f17c8711f6

View file

@ -19,7 +19,11 @@ module Haml
#
# @return [Boolean] Whether the XSS integration was enabled.
def try_enabling_xss_integration
return false unless ActionView::Base.respond_to?(:xss_safe?) && ActionView::Base.xss_safe?
return false unless (ActionView::Base.respond_to?(:xss_safe?) && ActionView::Base.xss_safe?) ||
# We check for ActiveSupport#on_load here because if we're loading Haml that way, it means:
# A) we're in Rails 3 so XSS support is always on, and
# B) we might be in Rails 3 beta 3 where the load order is broken and xss_safe? is undefined
(defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load))
Haml::Template.options[:escape_html] = true