From a6ea7e282fc0cbb837cb1c1e344c31264600114c Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Tue, 25 Jul 2017 23:01:03 +0900 Subject: [PATCH] Merge queries in Api::V1::FavouritesController (#4359) --- app/controllers/api/v1/favourites_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/api/v1/favourites_controller.rb b/app/controllers/api/v1/favourites_controller.rb index 92c0a62a98..9d73bb3379 100644 --- a/app/controllers/api/v1/favourites_controller.rb +++ b/app/controllers/api/v1/favourites_controller.rb @@ -20,9 +20,7 @@ class Api::V1::FavouritesController < Api::BaseController def cached_favourites cache_collection( - Status.where( - id: results.map(&:status_id) - ), + Status.reorder(nil).joins(:favourites).merge(results), Status ) end