Ruby on Rails Thursday, February 9, 2017

It is a boolean value, I did get it to work.  


On Thursday, February 9, 2017 at 12:30:31 PM UTC-5, Colin Law wrote:
On 9 February 2017 at 17:10, Joe Guerra <jgu...@jginfosys.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>

You should not have the <%= %> round Processing order as that is not ruby, so
<% if cart.processing == 'true'%>Processing order<% end %>
but possibly better
<%= "Processing order" if cart.processing == 'true' %>
That is assuming that cart.processing is a string not a boolean.

I suspect your original code would have shown an error in the console
and development.log, in which case it is always a good idea to post
the error when asking for help.

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/976291ba-7f61-41ea-ba31-af08b3f21433%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment