Thanks in advance

I want to know how to solve No method errors

Agile Rails 4th ed

Great book

But second time I get this type of error

I would like to know how to troubleshoot and resolve

Please see below thanks once again


NoMethodError in Store#index

Showing C:/rails/shop9/app/views/line_items/_line_item.html.erb where
line #9 raised:

undefined method `title' for nil:NilClass

Extracted source (around line #9):

6: <% end %>

8:   <td><%= line_item.quantity %>&times;</td>
9:   <td><%= line_item.product.title %></td>
10:   <td class="item_price"><%=
number_to_currency(line_item.total_price) %></td>
11: </tr>

Trace of template inclusion: app/views/carts/_cart.html.erb,
app/views/layouts/application.html.erb

Rails.root: C:/rails/shop9
Application Trace | Framework Trace | Full Trace

app/views/line_items/_line_item.html.erb:9:in
`_app_views_line_items__line_item_html_erb__441883346_13180080__860564653'
app/views/carts/_cart.html.erb:3:in
`_app_views_carts__cart_html_erb___244752806_13248624_537741326'
app/views/layouts/application.html.erb:37:in `block in
_app_views_layouts_application_html_erb___681624400_16614672_759801029'
app/helpers/application_helper.rb:6:in `hidden_div_if'
app/views/layouts/application.html.erb:36:in
`_app_views_layouts_application_html_erb___681624400_16614672_759801029'

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to