This fixes an issue when we call content_for within a content_for block when using HAML. The issue arises from each block using the same Context class. This meant that it's trying to access the same buffer, and the second content_for block resets the buffer, resulting in an empty buffer for the first content_for block, and therefore no content.
We fixed this by keeping track of a buffer hash for each time we need to save, retrieve, and empty the buffer.
Tested
See tests in spec/frontman/helpers/render_helper_spec.rb.
Description
This fixes an issue when we call
content_for
within acontent_for
block when using HAML. The issue arises from each block using the sameContext
class. This meant that it's trying to access the same buffer, and the secondcontent_for
block resets the buffer, resulting in an empty buffer for the firstcontent_for
block, and therefore no content.We fixed this by keeping track of a buffer hash for each time we need to save, retrieve, and empty the buffer.
Tested
See tests in
spec/frontman/helpers/render_helper_spec.rb
.