Snippets with comments cause a 500 when they show up in search results
This occurs when you search for a snippet that has a comment. Here's how to reproduce:
- Create a snippet.
- In the comment field, enter "Supercalifragilisticexpialidocious".
- Search for "Supercalifragilisticexpialidocious".
- Click on "Comments".
-Stan
/cc: @rspeicher
https://sentry.gitlap.com/gitlab/gitlabcom/issues/3643/
NoMethodError: undefined method `iid' for #<ProjectSnippet:0x007faa06841cc0>
app/views/search/results/_note.html.haml:18:in `_app_views_search_results__note_html_haml__3011065897183706563_70184116382260'
%span #{note.noteable_type.titleize} ##{note.noteable.iid}
app/views/search/_results.html.haml:20:in `_app_views_search__results_html_haml___3568432111070933049_70184117488600'
= render partial: "search/results/#{@scope.singularize}", collection: @objects
app/views/search/show.html.haml:7:in `_app_views_search_show_html_haml__2673936590556281126_48154940'
= render 'search/results'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
retval = trans.run { @app.call(env) }
lib/gitlab/metrics/transaction.rb:45:in `run'
yield
...
(163 additional frame(s) were not displayed)
ActionView::Template::Error: undefined method `iid' for #<ProjectSnippet:0x007faa06841cc0>
app/views/search/results/_note.html.haml:18:in `_app_views_search_results__note_html_haml__3011065897183706563_70184116382260'
%span #{note.noteable_type.titleize} ##{note.noteable.iid}
app/views/search/_results.html.haml:20:in `_app_views_search__results_html_haml___3568432111070933049_70184117488600'
= render partial: "search/results/#{@scope.singularize}", collection: @objects
app/views/search/show.html.haml:7:in `_app_views_search_show_html_haml__2673936590556281126_48154940'
= render 'search/results'
lib/gitlab/metrics/rack_middleware.rb:17:in `block in call'
retval = trans.run { @app.call(env) }
lib/gitlab/metrics/transaction.rb:45:in `run'
yield
...
(163 additional frame(s) were not displayed)