Best way to use html5 data attributes with rails content_tag helper?

前端 未结 6 750
清酒与你
清酒与你 2020-12-02 09:48

The issue, of course, is that ruby symbols don\'t like hyphens. So something like this obviously won\'t work:

content_tag(:div, \"Some Text\", :id => \"fo         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 10:21

    You can always create you own helper function so then you can write

    <%= div_data_tag the_id, some_text, some_data %>
    

提交回复
热议问题