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

前端 未结 6 744
清酒与你
清酒与你 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 09:59

    JQuery Air (codeschool.com) Level 1, Example 1

    Codeschool/platform-independent version

    Rails Version

    • <%= content_tag(:a, "Sep 27",:href=> "#2012-09-27", :data => { :flights => "6" } ) %>
    • <%= content_tag(:a, "Sep 28",:href=> "#2012-09-28", :data => { :flights => "5" } ) %>
    • <%= content_tag(:a, "Sep 29",:href=> "#2012-09-29", :data => { :flights => "5" } ) %>

提交回复
热议问题