NoMethodError in Web#web_product

Showing /var/www/vhosts/rekordsport.es/rekordsportnew/app/views/layouts/web.html.erb where line #113 raised:

undefined method `image_url' for nil:NilClass

Extracted source (around line #113):

110
111
112
113
114
115
116
          
<meta property="og:type" content="website" />
<meta property="og:title" content="<%= Product.where(:id => params[:id]).first.name %>" />
<meta property="og:description" content="<%= Product.where(:id => params[:id]).first.description %>" />
<meta property="og:image" content="<%= "https://#{request.host}#{Product.where(:id => params[:id]).first.photos.first.image_url(:thumb)}" %>" />
<% end %>
<%= stylesheet_link_tag "web" %>

Rails.root: /var/www/vhosts/rekordsport.es/rekordsportnew

Application Trace | Framework Trace | Full Trace
app/views/layouts/web.html.erb:113:in `_app_views_layouts_web_html_erb__3647292981166092884_46969820233940'

Request

Parameters:

{"id"=>"2505-calcetin-puma-largo-blanco-unisex"}

Response

Headers:

None