NoMethodError in Web#web_subcategory

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

undefined method `category' for nil:NilClass

Extracted source (around line #37):

34
35
36
37
38
39
40
          
<% end %>
<% end %>
],
item_list_id: <%= @products.first.category.id %>,
item_list_name: "<%= @products.first.category.name %>",
currency: "EUR",
},

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

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

Request

Parameters:

{"brands"=>"PALLADIUM",
 "id"=>"1-hombre"}

Response

Headers:

None