Skip to content
Snippets Groups Projects
Commit 78207b95 authored by Douwe Maan's avatar Douwe Maan
Browse files

Move includes call to scope

parent 257f4eaa
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -21,7 +21,7 @@ class Discussion
end
 
def self.build_collection(notes, context_noteable = nil)
grouped_notes = notes.includes(:noteable).group_by { |n| n.discussion_id(context_noteable) }
grouped_notes = notes.group_by { |n| n.discussion_id(context_noteable) }
grouped_notes.values.map { |notes| build(notes, context_noteable) }
end
 
Loading
Loading
Loading
Loading
@@ -110,7 +110,7 @@ class Note < ActiveRecord::Base
end
 
def discussions(context_noteable = nil)
Discussion.build_collection(fresh, context_noteable)
Discussion.build_collection(all.includes(:noteable).fresh, context_noteable)
end
 
def find_discussion(discussion_id)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment