图像标记显示模型的所有列

时间:2013-06-19 12:36:04

标签: ruby-on-rails ruby ruby-on-rails-3

昨天我在carrierwav上做了一些经验,一切正常,但在图像标签上通常只显示图像轨道也会显示孔模型,created_at等等。在这里你可以看到它!{{0 }}

现在我的观点是:

<% @patient.treatments.each do |treatment| %>
<tr>
  <td><%= treatment.category.try(:typ) %></td>
  <td><%= treatment.content %></td>
  <td><%= treatment.day %></td>
  <td><div class="arrow"></div></td>
</tr>
<tr>
  <td colspan="5">
    <%= link_to 'Löschen', [treatment.patient, treatment],
                            :confirm => 'Sind sie sicher?',
                            :method => :delete %>
    <%= treatment.paintings.each do |paint| %>                          
      <%= image_tag paint.name %>
    <% end %>
   </td>
 </tr>
<% end %>

问题必须在<%= image_tag paint.name %>

1 个答案:

答案 0 :(得分:7)

=移除<%= treatment.paintings.each do |paint| %>,这样您也可以打印treatment.paintings数组。

    <% treatment.paintings.each do |paint| %>                          
      <%= image_tag paint.name %>
    <% end %>