mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
DRY on controllers/conferences_controller
Conferences.incoming is defined on the model as scope:
scope :upcoming, (-> { where('end_date >= ?', Date.current) })
Conference.past
scope :past, (-> { where('end_date < ?', Date.current) })
This commit is contained in:
parent
f50a92bf53
commit
490ea3c4b4
1 changed files with 2 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue