In upgrading an older Rails app to the latest and greatest versions of everything, I've discovered that the haml_tag helper method was removed from Haml::Helpers in version 6. A quick grep of the haml and haml-rails sources reveal that there are no references to it (other than the changelog noting its removal).
haml_tag lets you generate output with an arbitrary tag name, attributes, and content, like this:
- tag_name = my_content_model.tag_name || "section" # something dynamic
- haml_tag(tag_name, {attr: value, attr2: value2}) do
%div.inner
%h2 Contents go here.
I make heavy use of haml_tag in a CMS where users can pick a tag name for their blocks of content, and would prefer not to have to redesign that feature. Is there an adequate replacement for it, perhaps in a third-party library?
(For now I have my Gemfile locking HAML to version 5)
It seems like the answer here is to change calls from
haml_tagtocontent_tagwhen using haml v6.