J'ai un projet Rails: utilisateur-> Projet-> ExempleRails rend mes données brutes dans la configuration html
Quand je regarde mes projets comme table tout est bien. Je rends un modèle de table:
<%= render 'layouts/projects_table' %>
mais quand je rends mes échantillons pour un projet
<%= render 'layouts/samples_table' %>
Je reçois la table, mais avant la table, je reçois mes données brutes rendu:
[#<Sample id: 28, name: "abcd", size: 11, quantity: 11.0, created_at: "2013-04-04 09:58:50"> ... ]
ProjetsContrôleur:
def show
@project = Project.find(params[:id])
@samples = @project.samples
end
_samples_table:
<table id="samples" class="display">
<thead>
<tr>
<th>
Sample Name
</th>
<th>
Size
</th>
<th>
Quantity
</th>
<th>
</th>
</tr>
</thead>
<tbody>
<%= @samples.each do |sample| %>
<tr>
<td>
<%= link_to sample.name, project_sample_path(@project, sample) %>
</td>
<td>
<%= sample.size %>
</td>
<td>
<%= sample.quantity %>
</td>
<td>
<% if !sample.libraries.any?%>
<%= link_to 'Del', project_sample_path(@project, sample),
:confirm => 'Are you sure?', :method => :delete %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
Tout le reste fonctionne bien. Toute aide serait appréciée!
Oliver
Vous devez nous montrer le code dans votre 'vue samples_table'. – jdl