From cc0c4436d186e9d6b45133dbe27028d7777408ba Mon Sep 17 00:00:00 2001 From: "Billy.Zheng" Date: Thu, 13 Jun 2024 09:53:09 +0800 Subject: [PATCH] Try add memoize to chong_wen_bao_for(user) --- src/models/university.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/university.cr b/src/models/university.cr index 5b56962..ad18865 100644 --- a/src/models/university.cr +++ b/src/models/university.cr @@ -81,7 +81,7 @@ class University < BaseModel has_many chong_wen_baos : ChongWenBao end - def chong_wen_bao_for(user) + memoize def chong_wen_bao_for(user : User) : ChongWenBao? chong_wen_baos.find do |x| x.user_id == user.id end