registration_limit check moved to ability file
This commit is contained in:
parent
0018284c66
commit
866e58b5bf
2 changed files with 5 additions and 8 deletions
|
|
@ -6,7 +6,7 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
|
||||
def new
|
||||
@registration = Registration.new(conference_id: @conference.id)
|
||||
authorize! :new, @registration
|
||||
authorize! :new, @registration, message: "Sorry, you can not register for #{@conference.title}. Registration limit exceeded or the registration is not open."
|
||||
|
||||
# Redirect to registration edit when user is already registered
|
||||
if @conference.user_registered?(current_user)
|
||||
|
|
@ -23,11 +23,6 @@ class ConferenceRegistrationsController < ApplicationController
|
|||
redirect_to edit_conference_conference_registrations_path(@conference.short_title)
|
||||
end
|
||||
|
||||
if @conference.registration_limit_exceeded?
|
||||
redirect_to root_path, error: "Sorry, registration limit exceeded for #{@conference.title}"
|
||||
return
|
||||
end
|
||||
|
||||
# @user variable needs to be set so that _sign_up_form_embedded works properly
|
||||
@user = @registration.build_user
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue