[Haml] Fix some Rails 3 compatibility.

This commit is contained in:
Nathan Weizenbaum 2010-02-15 17:45:26 -08:00
parent 7ddd9f3581
commit 87ccc14524
2 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,9 @@
* Calls to `defined?` shouldn't interfere with Rails' autoloading
in very old versions (1.2.x).
* Fix a bug where calls to ActionView's `render` method
with blocks and layouts wouldn't work under the Rails 3.0 beta.
## 2.2.19
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.19).

View File

@ -519,12 +519,12 @@ END
# @yield A block in which the given buffer should be used
def with_haml_buffer(buffer)
@haml_buffer, old_buffer = buffer, @haml_buffer
old_buffer.active, was_active = false, old_buffer.active? if old_buffer
@haml_buffer.active = true
old_buffer.active, old_was_active = false, old_buffer.active? if old_buffer
@haml_buffer.active, was_active = true, @haml_buffer.active?
yield
ensure
@haml_buffer.active = false
old_buffer.active = was_active if old_buffer
@haml_buffer.active = was_active
old_buffer.active = old_was_active if old_buffer
@haml_buffer = old_buffer
end