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
|
end
|
||||||
|
|
||||||
def appearances
|
def appearances
|
||||||
|
@appearances ||= build_appearances
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_appearances
|
||||||
all_swf_assets = swf_assets.to_a
|
all_swf_assets = swf_assets.to_a
|
||||||
|
|
||||||
# If there are no assets yet, there are no appearances.
|
# If there are no assets yet, there are no appearances.
|
||||||
|
|
Loading…
Reference in a new issue