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

Check for Rails before using __in_erb_template

The tests all load (some version of) Rails. Haml is not always going to
be used in a Rails environment, and ap_ge3? will be false in these
situations, so __in_erb_template will be used, generating
needless warnings.

Check that Rails is loaded, as well as it being an earlier version,
before using __in_erb_template in generated code.
This commit is contained in:
Matt Wildig 2012-05-28 00:19:40 +01:00 committed by Norman Clarke
parent 535840d97b
commit e1510319a4

View file

@ -14,7 +14,7 @@ extend Haml::Helpers
_hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options_for_buffer.inspect}) _hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options_for_buffer.inspect})
_erbout = _hamlout.buffer _erbout = _hamlout.buffer
END END
preamble << "__in_erb_template = true;" unless ap_geq_3? preamble << "__in_erb_template = true;" if rails_env && !ap_geq_3?
postamble = <<END.gsub("\n", ";") postamble = <<END.gsub("\n", ";")
#{precompiled_method_return_value} #{precompiled_method_return_value}
ensure ensure