Ruby ternary operator in erb?

后端 未结 1 1412
野的像风
野的像风 2021-01-08 00:40

How can I make this code look better:

<%=raw manuscript.uploaded_to_s3? ? \"\" : \"

        
相关标签:
1条回答
  • 2021-01-08 00:55
    <span style="color:<%= manuscript.uploaded_to_s3? ? 'green' : 'red' %>">
    

    I would advocate a CSS class rather than style attribute 8P:

    <span class="<%= manuscript.uploaded_to_s3? ? 'green' : 'red' %>">
    
    0 讨论(0)
提交回复
热议问题