From the Rails concat , concat supposed to be used only in the <% %> concat <% %> code block. When you use it in a code block <%= %> , you see it twice because concat adds the provided text to the output buffer, but then it also returns the entire output buffer back to your helper method, which is then output using <%= , which will lead to duplication of the entire page.
Usually you donβt need to use concat lot, if at all (I never came across a situation where I needed it). In your assistant you can simply do this:
def test "Hello world" end
And then use <%= test %> in your view.
source share