NoMethodError in Web#web_subcategory

Showing /var/www/vhosts/yourwaystore.es/yourwaystore/app/views/web/web_subcategory.html.erb where line #41 raised:

undefined method `category' for nil:NilClass

Extracted source (around line #41):

38
39
40
41
42
43
44
          
<% end %>
<% end %>
],
item_list_id: <%= @products.first.category.id %>,
item_list_name: "<%= @products.first.category.name %>",
currency: "EUR",
},

Rails.root: /var/www/vhosts/yourwaystore.es/yourwaystore

Application Trace | Framework Trace | Full Trace
app/views/web/web_subcategory.html.erb:41:in `_app_views_web_web_subcategory_html_erb___2793568634029356182_70111812102560'

Request

Parameters:

{"page"=>"21",
 "id"=>"2-inicio"}

Response

Headers:

None