Please do yourself a favor and visit the Rails Guides site:
http://guides.rubyonrails.com and read them. All of this is documented well.
To add a data attribute in ERB, you make a nested hash with data as the outermost key:
<%= link_to( nil, data: { data_toggle: 'dropdown' }, role: 'button', 'aria-expanded': 'false' ) do %>
Groups
<span class="caret"></span>
<%- end %>
You didn't ask about aria-expanded, but that's how you would add that as well (Ruby 2.3 syntax, don't try this on 1.9.x). The point of using data as a hash is that you often have many different data-attributes on the same element, so you would do data: { foo: 'bar', baz: 'boo' } and end up with data-foo="bar" data-baz="boo" in the generated HTML.
Walter
> To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/54fd5772eebc2f8f2d02cc6d50110fee%40ruby-forum.com.