You can say this in helpers like link_to
and content_tag
:
= link_to 'Label', root_url, :data => { :foo => 'bar', :bam => 'baz' }
This will produce:
<a href="/" data-foo="bar" data-bam="baz">Label</a>
Only works in Rails 3. In Rails 2 you do
= link_to 'Label', root_url, 'data-foo' => 'bar', 'data-bam' => 'baz' }
Posted by Henning Koch to makandra dev (2012-07-21 14:35)