Make content_tag_for work without block

This is version of #8640 for master