Created
May 31, 2011 01:27
-
-
Save justinfrench/999731 to your computer and use it in GitHub Desktop.
Did you know there's a less painful way to do data attributes in Rails?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This has very little win: | |
<%= content_tag(:p, "Foo", "data-bah" => "...", "data-baz" => "...") %> | |
# Some chumps make it even more noisy: | |
<%= content_tag(:p, "Foo", :"data-bah" => "...", :"data-baz" => "...") %> | |
# I was going to patch Rails to convert :data_bah to "data-bah" | |
<%= content_tag(:p, "Foo", :data_bah => "...", :data_baz => "...") %> | |
# But they already do this: | |
<%= content_tag(:p, "Foo", :data => {:bah => "...", :baz => "..."}) %> | |
# Good enuff, thankz Railz!!!!!!!! |
benhoskings
commented
May 31, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment