Merge pull request #2629 from esparta/conference_index_dry

DRY on controllers/conferences_controller#index
This commit is contained in:
Henne Vogelsang 2021-03-06 19:10:45 +01:00 committed by GitHub
commit d928be7e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,8 +6,8 @@ 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 = Conference.where('end_date < ?', Date.current)
@current = Conference.upcoming.reorder(start_date: :asc)
@antiquated = Conference.past
if @antiquated.empty? && @current.empty? && User.empty?
render :new_install
end