optimize queries

This commit is contained in:
Zach Kemp 2018-04-11 15:03:05 -07:00 committed by James Mason
parent 8a422412d6
commit 7d5d935a65
8 changed files with 101 additions and 43 deletions

View file

@ -6,8 +6,9 @@ class ConferencesController < ApplicationController
load_and_authorize_resource find_by: :short_title, except: :show
def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
@antiquated = @conferences - @current
@current, @antiquated = Conference.reorder(start_date: :asc).all.partition do |conference|
conference.end_date >= Date.current
end
end
def show