Hello i was wondering is there was any way of using an IF statement in a
.rhtml..?
So far i have this:
<div class='bar2' id='barpo6'><strong>State: </strong><%= if
@boards.running == "1" render :text => "Running" %></div>
<...>
<%= @boards.running==1?'Running':'Waiting' %>
Regards,
Rimantas
Phlip
(Phlip)
2
Ro Vent wrote:
<div class='bar2' id='barpo6'><strong>State: </strong>
<% if @boards.running == "1" %>
<%= render :text => "Running" %>
<% else %>
<%= render :text => "Waiting" %>
<% end %>
</div>
The excess %><% freak me out.
<%= render :text => if @boards.running == "1"
"Running"
else
"Waiting"
end %>
Idiomatic but legible!
rab
(Rob Biedenharn)
3
=> false
Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
>> 1=="1"
=> false
That's one thing. Second: you shouldn't use render :text in .rhtml
templates. I does not work there (AFAIK).
Regards,
Rimantas