Concat in View Helpers
A common technique to simplify logic in views is to use helpers to define blocks that conditionally include content. For instance a helper to only include a block if the user is logged in could look like:
and would be used like this in a view
In Rails 3.0, this results in the block being included twice. The new convention is that if a Ruby code block in an erb is going to output something, if should be coded as
<%= %>. In this case the
concat method is no longer necessary. The
content_tag method can directly take a block as a parameter as well.
This can be simplified to