We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<% test = capture do %> <% [1, 2, 3].each do |v| %> <% next if v <= 3 %> <%= v %> <% end %> <% end %> <%= test if test.present? %>
outputs 123 while it is expected to output nothing. This happens because of Cell::Erb#capture returning yielded value if buffer is empty
123
Cell::Erb#capture
def capture(*args) value = nil buffer = with_output_buffer { value = yield(*args) } return buffer.to_s if buffer.size > 0 value # this applies for "Beachparty" string-only statements. <<<< this end
ActionView::Helpers::CaptureHelper#capture has an additional check on string.is_a?(String) and returns nil if it fails
ActionView::Helpers::CaptureHelper#capture
string.is_a?(String)
Temporary workaround is to put <% nil %> as the last line of capture block
<% nil %>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
outputs
123
while it is expected to output nothing. This happens because ofCell::Erb#capture
returning yielded value if buffer is emptyActionView::Helpers::CaptureHelper#capture
has an additional check onstring.is_a?(String)
and returns nil if it failsTemporary workaround is to put
<% nil %>
as the last line of capture blockThe text was updated successfully, but these errors were encountered: