Break up the one-query-of-doom

The single query was producing a tremendously large ActiveRecord allocation.

While this isn't nearly as cool as one query, it's still a significant
reduction in SQL trips, and now has the bonus of only loading what is
actually going to be displayed.
This commit is contained in:
James Mason 2017-12-21 19:06:36 -08:00
parent 754d201b01
commit fa55224163
26 changed files with 181 additions and 165 deletions

View file

@ -1,4 +1,4 @@
- cache [conference, conference.call_for_tracks, '#splash#callfortracks'] do
- cache [conference_id, call, '#splash#callfortracks'] do
.col-md-5.col-sm-5.text-center
%h2
Call for Tracks
@ -8,13 +8,12 @@
Would you like to host a mini-summit, sub-conference, or hack space?
The submission period for track requests is open
%em
= date_string(conference.call_for_tracks.start_date,
conference.call_for_tracks.end_date) + '.'
= date_string(call.start_date, call.end_date) + '.'
%b
You have
= pluralize(conference.call_for_tracks.remaining_days, 'day')
= pluralize(call.remaining_days, 'day')
left!
%p.cta-button
= link_to("Submit your request for track",
conference_program_tracks_path(conference.short_title),
conference_program_tracks_path(conference_id),
class: 'btn btn-success btn-lg text-center')