Using if statements in View

Hi out there. I am trying to create a table that displays
information, and then changes the class of the row if a flag is
presented, but can’t determine if putting it in the view is the best
method for doing so or not. Right now, I have tried this in my view,
but it currently sets the columns to whichever is set into the if
statements first.

<% for widget in @widgets %>
<% if widget.flag = “–” && widget.second_flag = “–”%>


<% elsif widget.flag = “++” || widget.second_flag = “++”%>

<% elsif widget.flag = “–” || widget.second_flag = “–”%>

<%else%>
<tr class=“d<%= cycle(“0”, “1”) %>”>
<%end%>

If anyone has any advice, I would be very appreciative.

On Jul 9, 10:50 pm, “recent convert = me” [email protected]
wrote:

Hi out there. I am trying to create a table that displays
information, and then changes the class of the row if a flag is
presented, but can’t determine if putting it in the view is the best
method for doing so or not. Right now, I have tried this in my view,
but it currently sets the columns to whichever is set into the if
statements first.

<% for widget in @widgets %>
<% if widget.flag = “–” && widget.second_flag = “–”%>

Check your ruby: = is the assignment operator, == is the comparison
operator. You’d probably find this all flowed more naturally if you
wrapped this up in a view helper.

Fred