Ruby on Rails Thursday, February 9, 2017
Try it like this:On 2017-Feb-9, at 12:10 , Joe Guerra <email@example.com> wrote:I can't get my embedded if statement working in a html table.here's one row of my table from my cart index...<td><%= cart.created_at.strftime("%m/%d/%Y") %> | <%= cart.product_id %> | <% if cart.processing == 'true'%> <%= Processing order %> <% end %></td>basically I want to indicate when an item is being processed in the cart...
<td><%= cart.created_at.strftime("%m/%d/%Y") %> | <%= cart.product_id %> | <%= 'Processing order' if cart.processing == 'true'%></td>
Also, why is cart.processing returning a string? (Or why are you testing the value is 'true'?) It would be more natural to have cart.processing? be truthy.
Posted by Ruby on Rails at 10:02 AM