Skip to content

Commit b56e456

Browse files
committed
Preload some event data to speed up view render time
1 parent d403254 commit b56e456

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

app/policies/better_together/event_policy.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def event_host_member?
3535
# Filtering and sorting for calendars according to permissions and context
3636
class Scope < ApplicationPolicy::Scope
3737
def resolve
38-
scope.order(starts_at: :desc, created_at: :desc).where(permitted_query)
38+
scope.with_attached_cover_image.includes(:string_translations, :text_translations, :location, :event_hosts, categorizations: { category: %i[string_translations cover_image_attachment cover_image_blob] }).order(
39+
starts_at: :desc, created_at: :desc
40+
).where(permitted_query)
3941
end
4042

4143
protected

0 commit comments

Comments
 (0)