Issue with adding html5 data attributes to div tag #9

madhermit opened this Issue Oct 18, 2012 · 2 comments


None yet

2 participants


I'm running into an issue when trying to add a data attribute to a div tag like so:
div id: 'some-id', data: { foo: 'bar' }
this outputs the following:
<div class="some-id" data="{:foo=>"bar"}"></div>

Other formatting attempts such as data-foo => "bar" are met with syntax errors.

Any thoughts?


Arbre does not currently support building sub-hashes like content_for in Rails. However, you can get around it by using strings as the keys (since Ruby doesn't allow "-" in symbols):

div :id => "some-id", "data-foo" => "bar"
@gregbell gregbell closed this Oct 18, 2012

Thanks! Appreciate the response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment