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 => "foo", :data-data_attr => some_variable) One option is to use a string rather than a symbol: content_tag(:div, "Some Text", :id => "foo", 'data-data_attr' => some_variable) Or I could just interpolate: "<div id='foo' data-data_attr='#{some_variable}'>Som