From 6f4a0a92e6331b7033a8165c5b5e9cc7b0f880c2 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 3 Jun 2018 04:36:22 -0700 Subject: Eliminate N+1 queries with authors and push_data_payload in Events API --- lib/api/events.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/api/events.rb') diff --git a/lib/api/events.rb b/lib/api/events.rb index b0713ff1d54..fc4ba5a3188 100644 --- a/lib/api/events.rb +++ b/lib/api/events.rb @@ -17,6 +17,7 @@ module API def present_events(events) events = events.reorder(created_at: params[:sort]) + .with_associations present paginate(events), with: Entities::Event end -- cgit v1.2.3