Skip to content

Commit

Permalink
Try add memoize to chong_wen_bao_for(user)
Browse files Browse the repository at this point in the history
  • Loading branch information
zw963 committed Jun 13, 2024
1 parent 7cc3a0e commit cc0c443
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/models/university.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc0c443

Please sign in to comment.