Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image tag shows all columns of model

Yesterday i made some experience with carrierwav, all works fine but at the image tag where normally only the image should displayed rails also shows the hole model, with created_at etc. Here you cann see it!enter image description here

So now my view:

<% @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 %>

The problem has to be in <%= image_tag paint.name %>

like image 828
Em Sta Avatar asked Nov 20 '25 10:11

Em Sta


1 Answers

Remove the = from <%= treatment.paintings.each do |paint| %>, that is making you also print the treatment.paintings array.

    <% treatment.paintings.each do |paint| %>                          
      <%= image_tag paint.name %>
    <% end %>
like image 191
Luís Ramalho Avatar answered Nov 23 '25 05:11

Luís Ramalho