Thursday, 15 August 2013

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



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

i trying render label html attribute data-color if object attribute available.

this have, it's not rendering label assume because it's saying attribute isn't available don't show label, not attribute:

class="lang-rb prettyprint-override">f.label :value, choice.label, class: 'fs-button', data_color: choice.color if choice.attribute_present? :color

how set html attribute data-color if object attribute present? data-color attribute shouldn't show @ if attribute not present.

ruby-on-rails ruby-on-rails-4 attributes rendering

No comments:

Post a Comment