Is there an easy way to remove options attributes for the tag
or content_tag
helper?
<%= content_tag :div, content, {
class: 'content',
style: styles_hash.map{|x| "#{x[0].underscore.dasherize}: #{x[1]}"}.join('; '),
data: {
hyperlink: (hyperlink if hyperlink.present?)
}
} %>
In this example, I'm wondering how to remove the data-hyperlink
. Even if I throw a nil
or false
it stills displays as either data-hyperlink="null"
or data-hyperlink="false"
respectively. I need it to not display entirely if not present.