Optimisation to eager load regions when outputting events

remotes/origin/master
echarp 4 years ago
parent 76f0a33145
commit c60f6f4db3
  1. 1
      app/controllers/events_controller.rb

@ -87,6 +87,7 @@ class EventsController < ApplicationController
# The 3000 limit is purely arbitrary...
@events = apply_scopes Event.moderated.order('id desc')
.limit(params[:format] == 'rss' ? 20 : 3000)
@events = @events.includes :region if params[:format].present?
end
# Use callbacks to share common setup or constraints between actions

Loading…
Cancel
Save