Merge e0b1fec14d into eda5c2bc07
This commit is contained in:
commit
0ff08ba2bf
1 changed files with 8 additions and 0 deletions
|
|
@ -5,6 +5,14 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
before_action :set_registration, only: [:edit, :update, :destroy, :show]
|
||||
|
||||
def new
|
||||
# Check if conference is over
|
||||
# Display error if yes
|
||||
if @conference.end_date < Date.today
|
||||
flash[:alert] = "Sorry, the conference is already over."
|
||||
redirect_to root_path
|
||||
return
|
||||
end
|
||||
|
||||
# Redirect to registration edit when user is already registered
|
||||
if @conference.user_registered?(current_user)
|
||||
redirect_to edit_conference_conference_registrations_path(@conference.short_title)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue