Я использую код, загруженный из книги под названием Agile Web Development с Rails 4-е издание.Он предоставляет код для Rails 3.05 и Rails 3.1.Я использую последнее ... Я не понимаю сообщение об ошибке, которое оно выдало при попытке загрузить его на сервер.
Буду признателен, если вы сможете объяснить новичку ..
Это индекс, созданный для Продукта
<h1>Listing products</h1>
<table>
<% @products.each do |product| %>
<tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
<td>
<%= image_tag(product.image_url, :class => 'list_image') %>
</td>
<td class="list_description">
<dl>
<dt><%= product.title %></dt>
<dd><%= truncate(strip_tags(product.description),
length: 80) %></dd>
</dl>
</td>
<td class="list_actions">
<%= link_to 'Show', product %><br/>
<%= link_to 'Edit', edit_product_path(product) %><br/>
<%= link_to 'Destroy', product,
confirm: 'Are you sure?',
method: :delete %>
</td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New product', new_product_path %>
Это сообщение об ошибке
SyntaxError in Products#index
Showing /Users/michaeljohnmitchell/Sites/peep/app/views/products/index.html.erb where line #15 raised:
compile error
/Users/michaeljohnmitchell/Sites/peep/app/views/products/index.html.erb:15:
syntax error, unexpected ':', expecting ')'
length: 80) );@output_buffer.safe_concat('</dd>
^
/Users/michaeljohnmitchell/Sites/peep/app/views/products/index.html.erb:23:
syntax error, unexpected ':', expecting ')'
confirm: 'Are you sure?',
^
/Users/michaeljohnmitchell/Sites/peep/app/views/products/index.html.erb:23:
syntax error, unexpected ',', expecting ')'
Extracted source (around line #15):
12: <dl>
13: <dt><%= product.title %></dt>
14: <dd><%= truncate(strip_tags(product.description),
15: length: 80) %></dd>
16: </dl>
17: </td>
18:
Trace of template inclusion: app/views/products/index.html.erb
Rails.root: /Users/michaeljohnmitchell/Sites/peep
Application Trace | Framework Trace | Full Trace
app/views/products/index.html.erb:36:in `compile'
app/controllers/products_controller.rb:7:in `index'