Ruby on Rails: Rendering element tags with html options if attribute is present -


I'm trying to present a label with an HTML attribute data-color , But only if an object attribute is available

This is what I have, but it is not presenting the label that I believe because it is saying that the attribute is not available, so the label Do not show attribute:

  f.label: value, choice.label, category: 'fs-button', data_color: choice.color if Choice.attribute_pres Ent? : Color  

If I present the object attribute, how do I set the html attribute data-color ? If the property does not exist then the data-color attribute should not be visible at all.


Comments

Popular posts from this blog

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -