Skip to content

Commit

Permalink
hack around issue with return value vs output buffer in new_context
Browse files Browse the repository at this point in the history
  • Loading branch information
al2o3cr committed Oct 9, 2011
1 parent 2498d17 commit 8cf9783
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dryml/lib/dryml/template_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ def new_context
ctx = [ @_this, @_this_parent, @_this_field, @_this_type,
@_form_field_path, @_form_field_paths_by_object ]
@_this_type = nil
res = nil
@view.with_output_buffer { res = yield }
# TODO: remove THE HAX! We depend on the return value of this in some places, on the output buffer in others
inner_res = nil
outer_res = @view.with_output_buffer { inner_res = yield }
res = outer_res.blank? ? inner_res : outer_res
@_this, @_this_parent, @_this_field, @_this_type, @_form_field_path, @_form_field_paths_by_object = ctx
res.to_s
end
Expand Down

0 comments on commit 8cf9783

Please sign in to comment.