Cache the Item#appearances
field
We call it enough times on this page, and it *does* have a SQL query, that I want to cache it! (Also I want to make it fewer species queries if I can tbh…)
This commit is contained in:
parent
0305817cec
commit
176ab20fd1
1 changed files with 4 additions and 0 deletions
|
@ -533,6 +533,10 @@ class Item < ApplicationRecord
|
|||
end
|
||||
|
||||
def appearances
|
||||
@appearances ||= build_appearances
|
||||
end
|
||||
|
||||
def build_appearances
|
||||
all_swf_assets = swf_assets.to_a
|
||||
|
||||
# If there are no assets yet, there are no appearances.
|
||||
|
|
Loading…
Reference in a new issue