From 0bfa4276732272e97ef6c83c81a9242edfbc6b9f Mon Sep 17 00:00:00 2001 From: Michael Parrish Date: Mon, 3 Aug 2015 17:21:39 -0500 Subject: [PATCH] Preload BoardSerializer latest_discussion --- app/serializers/board_serializer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/serializers/board_serializer.rb b/app/serializers/board_serializer.rb index 09029446..7a617e3b 100644 --- a/app/serializers/board_serializer.rb +++ b/app/serializers/board_serializer.rb @@ -9,7 +9,8 @@ class BoardSerializer can_sort_by :created_at embed_attributes_from :project self.default_sort = 'created_at' - self.eager_loads = [:latest_discussion, :project, :parent] + self.preloads = [:latest_discussion] + self.eager_loads = [:project, :parent] def latest_discussion DiscussionSerializer.as_json model.latest_discussion