1
<% @s2_pmt_transact.each do |s2_pmt_transact| %>
<% if (s2_pmt_transact.key = 7) %>
<tr style="background-color:#EAEAEA">
<% else %>
<tr style="background-color:#FFFFFF">
<% end %>

I would like the cell coloring to be based on value of key as in the code above. But all values of key (7 and above) are printed just fine - but color coding seems to be just #EAEAEA for all of them. How can I enforce conditional coloring?

Biju
  • 820
  • 1
  • 11
  • 34

1 Answers1

0

Your conditional is wrong, needs to use == not = which is an assignment and explains why all are grey.

<% @s2_pmt_transact.each do |s2_pmt_transact| %>
 <% if s2_pmt_transact.key == 7 %>
  <tr style="background-color:#EAEAEA">
 <% else %>
  <tr style="background-color:#FFFFFF">
 <% end %>
Rockwell Rice
  • 3,376
  • 5
  • 33
  • 61