Flowdock
method

block_called_from_erb?

Importance_1
Ruby on Rails latest stable (v4.0.2) - 1 note - Class: ActionView::Helpers::TagHelper

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

block_called_from_erb?(block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Show source
Register or log in to add new notes.
March 25, 2009 - (>= v2.2.1)
1 thank

usage helper with block

helper example

def my_helper(&block)
  inner = capture(&block)
  out = "<somehtml>#{inner}</somehtml>"
  block_called_from_erb?(block) ? concat(out) : out
end

view example

<% my_helper do %>
  sometext
<% end %>

output

<somehtml>sometext</somehtml>

using ActionView::Helpers::CaptureHelper#capture