Ruby on Rails 3:我有一个表,其中一列根据 objects 布尔属性显示 true 或 false。我希望它显示是或否。
这是我的桌子:
<table id="resellers" class="table table-striped table-hover table-bordered" style="background-color: white">
<thead>
<button type="button" class="reset">Reset Search</button>
<th width="12%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Contact Name</th>
<th width="12%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Reseller</th>
<th width="11%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Region</th>
<th width="10%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Country</th>
<th width="18%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Email</th>
<th width="11%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Distributor</th>
<th width="11%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Registered</th>
<th width="10%" onMouseOver="this.style.color='#00F'" onMouseOut="this.style.color='black'">Approved</th>
<th width="5%" class="filter-false"></th>
</thead>
<tbody>
<% #current_grandstreamer.resellers.each do |reseller| %>
<% @resellers.each do |reseller| %>
<tr>
<td><%= reseller.contact_name %></td>
<td><%= link_to reseller.company_name, grandstreamers_reseller_path(reseller) %></td>
<td><%= reseller.company_region %></td>
<td><%= reseller.company_country %></td>
<td><%= reseller.contact_email %></td>
<td><%= reseller.distributor %></td>
<td><%= reseller.created_at.to_date.to_s %></td>
<td><%= reseller.approved %></td>
<td><%= link_to "Edit", edit_grandstreamers_reseller_path(reseller) %>
</tr>
<% end %>
</tbody>
有没有办法做一个 if 语句或在控制器中创建一个变量来显示?谢谢