As a developer, there are many times when printing a value is essential to debugging an application. Sometimes you are unable to use the
<%= string %> output block method.
The preferred method of outputting text in your views is to use the <%= “text” %> eRuby syntax. The regular puts and print methods do not operate as expected in an eRuby code block. If you absolutely must output text within a non-output code block (i.e., <% %>), you can use the concat method.
In other words the concat TextHelper method allows you to output strings within a <% code %> non-output code block. This can be helpful in debbuging by saving some time instead of writing something like this:
We could instead while debugging or potentially for output reasons (though I wouldn't recommend it) use the method concat to output the string directly from the <% %> block as so.
Although there are plenty of instances where using the concat method could be avoided via other output methods, having an additional tool for non-output blocks can sometimes come in handy.comments powered by Disqus