From e9f21006b0035f5d6d6eda9b4847cfe2fb2eabf6 Mon Sep 17 00:00:00 2001 From: chiu Date: Sun, 15 Mar 2020 11:55:45 +0800 Subject: [PATCH] change map id to pluck to accelerate mapping --- app/controllers/announcements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/announcements_controller.rb b/app/controllers/announcements_controller.rb index e429be1..7e390db 100644 --- a/app/controllers/announcements_controller.rb +++ b/app/controllers/announcements_controller.rb @@ -129,7 +129,7 @@ class AnnouncementsController < ApplicationController if anns_cache.count > 1 anns_cache.destroy end - AnnsCache.create(parent_id: subpart.id,locale: I18n.locale.to_s,filter_result: sorted_anns.map{|v| v.id}) + AnnsCache.create(parent_id: subpart.id,locale: I18n.locale.to_s,filter_result: sorted_anns.pluck(:id)) else sorted_anns = sorted_anns.sample(widget_data_count) end