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

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -