In the Rails helper, you can capture output of an ERB block using the capture method. However, what if a parameter is required for the ERB block? How can I use capture in this case?
For the given example:
<% my_helper(:parameter, models) do |model| %> <%= model.eye_color %> <% end %>
In the my_helper method my_helper I want to surround the output of each iteration of the <span class='color'>...</span> block.
I know that I can capture the output of an ERB block and save it in a variable using html = capture(&block) , but I do not know how to pass this model parameter to this block!
source share