If there are only one conference in the future and it has a public splashpage, redirect to it in conferences#index.

Change tests root_path to conference_path(conference).

fix #1259
This commit is contained in:
David Sedeño 2017-12-06 23:45:52 +01:00
parent 0cb273749a
commit 73fdcaf4c9
7 changed files with 174 additions and 140 deletions

View file

@ -6,6 +6,10 @@ class ConferencesController < ApplicationController
def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
@antiquated = @conferences - @current
redirect_to @current.first if @current.count == 1 &&
@current.first.splashpage &&
@current.first.splashpage.public
end
def show