NoMethodError in Web#web_subcategory

Showing /var/www/vhosts/lolitamoda.com/lolitamodav7/app/views/web/menu/_promotion_block.html.erb where line #7 raised:

undefined method `id' for nil:NilClass

Extracted source (around line #7):

4
5
6
7
8
9
10
          
<% if @category.parent.present? %>
<% BlockPromotion.where("(category_id = ? or category_id is NULL) and (brand_id = ? or brand_id is NULL )", @category.parent.parent.id, marca.id).each do |p| %>
<% if((Date.today >= p.start_date)&(Date.today < p.end_date)) %>

Trace of template inclusion: app/views/web/web_subcategory.html.erb

Rails.root: /var/www/vhosts/lolitamoda.com/lolitamodav7

Application Trace | Framework Trace | Full Trace
app/views/web/menu/_promotion_block.html.erb:7:in `_app_views_web_menu__promotion_block_html_erb___693368018230193181_47428316528440'
app/views/web/web_subcategory.html.erb:179:in `_app_views_web_web_subcategory_html_erb__3846749286711270205_47428318627620'

Request

Parameters:

{"brand"=>"ESPRIT",
 "id"=>"33-prenda-exterior-hombre"}

Response

Headers:

None