<%if @item.rigged %>Yes<%else%>No<%end%>
I was thinking of something like this?
if @item.rigged ? "Yes" : "No"
But it doesn't work. Ruby has the ||= but I"m not even sure how to use that thing.
<%if @item.rigged %>Yes<%else%>No<%end%>
I was thinking of something like this?
if @item.rigged ? "Yes" : "No"
But it doesn't work. Ruby has the ||= but I"m not even sure how to use that thing.
For simplicity, If you need to default to some value if nil you can use:
@something.nil? = "No" || "Yes"
if apple_stock > 1
:eat_apple
else
:buy_apple
end
Above statement can written in form of ternerary statement in ruby as:
apple_stock > 1 ? :eat_apple : :buy_apple
Don't forget it can generate the content from the ruby tag:
v
<%= @item.rigged? ? "Yes" : "No" %>
The tick (v) indicates using the equal sign to generate text in the html.