В моем контроллере у меня есть:
@invoices = current_user.account.clients.map(&:invoices).flatten
и в моем index.html.erb я хочу отобразить значения, в настоящее время у меня есть следующее:
<% @invoices.each do |invoice| %>
<tr>
<td></td>
<td><%= invoice.client.name %></td>
<td><%= invoice.jobs.inspect %></td> #HERE IS WHERE I WANT START_DATE, etc
<td><%= invoice.created_at %></td>
<td><%= link_to "PDF", invoice_path(invoice, :format => :pdf)%></td>
<td><%= link_to invoice, :method => :delete, :confirm => 'Are you sure you want to delete this invoice' do %> <i class="icon-trash"></i><% end %>
</td>
</tr>
<% end %>
invoice.jobs.inspect возвращает следующее:
[#<Job id: 15, start_date: "2012-03-24", due_date: "2012-03-31", notes: "grthryrth", audio_file_url: "1.txt", transcribed_file_url: "300.txt", status: "invoiced", account_id: 1, user_id: 1, client_id: 2, created_at: "2012-03-29 18:03:14", updated_at: "2012-03-29 18:40:49", invoice_id: 6>, #<Job id: 16, start_date: "2012-03-24", due_date: "2012-03-21", notes: "uopuiouioiio", audio_file_url: "Data Flow Analysis and Integration v1.1.docx", transcribed_file_url: "ECA-Sponsor Monthly Agenda 20120105.doc", status: "invoiced", account_id: 1, user_id: 4, client_id: 2, created_at: "2012-03-29 18:05:24", updated_at: "2012-03-29 18:40:49", invoice_id: 6>]
Как мне получить доступ к каждому значению по отдельности, например, invoice.jobs.start_date? Спасибо!