Closed mooreniemi closed 3 years ago
Reported by: https://twitter.com/IzzyOnYaTL/status/1378752897475878912
heroku logs -t:
heroku logs -t
2021-04-04T16:59:06.801642+00:00 app[web.1]: method=GET path=/pins format=html controller=PinsController action=index status=500 error='ActionView::Template::Error: undefined method `url' for nil:NilClass' duration=205.95 view=0.00 db=35.74 2021-04-04T16:59:06.805170+00:00 app[web.1]: 2021-04-04T16:59:06.805172+00:00 app[web.1]: ActionView::Template::Error (undefined method `url' for nil:NilClass): 2021-04-04T16:59:06.805173+00:00 app[web.1]: 22: <%= render partial: "latest_comment_snippet", locals: { pin: pin } if @comments.map(&:commentable_id).include?(pin.id) %> 2021-04-04T16:59:06.805174+00:00 app[web.1]: 23: <% cache([pin, @safe_mode]) do %> 2021-04-04T16:59:06.805175+00:00 app[web.1]: 24: <div class="image" itemprop="image"> 2021-04-04T16:59:06.805175+00:00 app[web.1]: 25: <%= link_to (image_tag pin.cover_image(@safe_mode).url(:medium)), pin %> 2021-04-04T16:59:06.805176+00:00 app[web.1]: 26: </div> 2021-04-04T16:59:06.805176+00:00 app[web.1]: 27: <p class="description" itemprop="description"> 2021-04-04T16:59:06.805177+00:00 app[web.1]: 28: <%= pin.try(:procedure).try(:name) %> by <strong><%= pin.unknown_surgeon? ? 'unknown' : 'Dr. ' + pin.surgeon.to_s %></strong> 2021-04-04T16:59:06.805178+00:00 app[web.1]: app/views/pins/_pin.html.erb:25:in `block in _app_views_pins__pin_html_erb___4329383566601151326_47424557209260' 2021-04-04T16:59:06.805178+00:00 app[web.1]: app/views/pins/_pin.html.erb:23:in `_app_views_pins__pin_html_erb___4329383566601151326_47424557209260' 2021-04-04T16:59:06.805179+00:00 app[web.1]: app/views/pins/index.html.erb:8:in `_app_views_pins_index_html_erb___603324957800333702_47424545555080' 2021-04-04T16:59:06.805179+00:00 app[web.1]: app/controllers/pins_controller.rb:13:in `index' 2021-04-04T16:59:06.805179+00:00 app[web.1]: 2021-04-04T16:59:06.805180+00:00 app[web.1]:
Going to check for the nil cover_image but also should protect it within the partial.
nil
cover_image
39 results have nil cover_image.
I have a fix I think, checking for nil images.last.
images.last
Reported by: https://twitter.com/IzzyOnYaTL/status/1378752897475878912
heroku logs -t
: