I have an ERB view with two blocks:
<%= test_h1 do %>
  <%= 'test1' %>
<% end -%>
<%= test_h2 do %>
  <%= 'test2' %>
<% end -%>
where test_h1 and test_h2 are similar helpers, but one is defined in a helper file, while another via helper_method in a controller:
module TestHelper
  def test_h1(&block)
    link_to '/url' do
      capture(&block)
    end
  end
end
class TestController < ApplicationController
  helper_method :test_h2
  def test_h2(&block)
    helpers.link_to '/url' do
      helpers.capture(&block)
    end
  end
end
test_h1 produces the expected result and test_h2 renders the inner template block first:
<a href="/url">test1</a>
test2<a href="/url"></a>
Why? What would be an idiomatic way to write test_h2 ?
 
     
     
     
    