我认为这是:
<tr>
<td>
<% if transaction.category.blank? %>
<a ... > ... </a>
<% else %>
<% if transaction.to_account_id.blank? %>
<a ...> ... </a>
<% else %>
<a ...> ... </a>
<% end %>
<% end %>
</td>
.
.
.
</tr>
a元素相当大,所以我省略了它们。
我需要检查事务是否没有类别,然后使用第一个if else语句中的第一个条件。
如果事务有我需要检查的类别,它是否在from_account_id和to_account_id列中有值。因此,我使用另一个if else语句来检查 if to_account_idis blank,如果是,则使用第二个if else语句中的第一个条件。
但是第二个if else语句不起作用。事实上,我只看到<tr>sto_account_id有价值的地方。第一if else条语句(带category检查)工作正常。
另外我想知道为什么if else会<td>影响<tr>能见度。
提前致谢!