Skip to content

Commit

Permalink
Preload BoardSerializer latest_discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Parrish committed Aug 3, 2015
1 parent 3f606c4 commit 0bfa427
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/serializers/board_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0bfa427

Please sign in to comment.