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:
parent
754d201b01
commit
fa55224163
26 changed files with 181 additions and 165 deletions
|
|
@ -46,7 +46,6 @@ class Conference < ApplicationRecord
|
|||
has_many :campaigns, dependent: :destroy
|
||||
has_many :commercials, as: :commercialable, dependent: :destroy
|
||||
has_many :subscriptions, dependent: :destroy
|
||||
has_one :call_for_sponsors, -> { where(cfp_type: 'sponsors') }, through: :program, source: :cfps
|
||||
has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps
|
||||
has_one :call_for_booths, -> { where(cfp_type: 'booths') }, through: :program, source: :cfps
|
||||
has_one :call_for_tracks, -> { where(cfp_type: 'tracks') }, through: :program, source: :cfps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue