我正在构建一个应用程序来管理牙医和位置。我刚刚完成了位置显示页面并添加了代码以显示该位置所有从业者的列表。但是,当我呈现页面时,它会将整个哈希(locations.practitioner.each)转储到我的格式化列表上方。如何让哈希消失?
这是我的 show.html.erb
<p>
<b>Location name:</b>
<%= @location.location_name %>
</p>
<p>
<b>Location id:</b>
<%= @location.id %>
</p>
<p><strong>Practitioners at this Location</strong></p>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Role</th>
<th>Production Goal</th>
<th></th>
</tr>
<%= @location.practitioner.each do |practitioner| %>
<tr>
<td><%= practitioner.first_name %></td>
<td><%= practitioner.last_name %></td>
<td><%= practitioner.role %></td>
<td><%= practitioner.production_goal %></td>
<td><%= link_to "Edit", edit_practitioner_path(practitioner) %></td>
</tr>
<% end %>
</table>
这是页面的外观......
Location name: Waterview
Location id: 1
Practitioners at this Location
[#<Practitioner id: 1, first_name: "Dr. Robert", last_name: "Anjoux", role: "Dentist", production_goal: 10000, location_id: 1, created_at: "2013-03-26 17:34:38", updated_at: "2013-03-26 21:52:37">,
#<Practitioner id: 3, first_name: "Smantha", last_name: "Hickleberry", role: "Hygenist", production_goal: 4800, location_id: 1, created_at: "2013-03-26 21:49:46", updated_at: "2013-03-26 21:49:46">,
#<Practitioner id: 4, first_name: "Dr. Sandra", last_name: "Prenger", role: "Dentist", production_goal: 22000, location_id: 1, created_at: "2013-03-26 22:05:38", updated_at: "2013-03-26 22:05:38">]
**First Name Last Name Role Production Goal**
Dr. Robert Anjoux Dentist 10000 Edit
Smantha Hickleberry Hygenist 4800 Edit
Dr. Sandra Prenger Dentist 22000 Edit
我究竟做错了什么?我只是表格列表...
丹尼斯