From 6e698b254ecddf23a866d9e98a885912102ccbce Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 22 May 2017 15:56:20 -0500 Subject: Fix specs --- app/models/note.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/models/note.rb b/app/models/note.rb index b4228cc6492..fc8baa66b2f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -121,7 +121,7 @@ class Note < ActiveRecord::Base end def grouped_diff_discussions(diff_refs = nil) - groups = Hash.new { |h, k| h[k] = [] } + groups = {} diff_notes.fresh.discussions.each do |discussion| line_code = @@ -131,7 +131,10 @@ class Note < ActiveRecord::Base discussion.original_line_code end - groups[line_code] << discussion if line_code + if line_code + discussions = groups[line_code] ||= [] + discussions << discussion + end end groups -- cgit v1.2.1