From c3c8c2df34b9d0022296516433183594a1949dda Mon Sep 17 00:00:00 2001 From: Matt Barringer Date: Wed, 6 Feb 2013 18:12:13 +0100 Subject: [PATCH] Registrations should work w/o supporter levels --- .../conference_registration_controller.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/conference_registration_controller.rb b/app/controllers/conference_registration_controller.rb index 6c5184e7..9beb3019 100644 --- a/app/controllers/conference_registration_controller.rb +++ b/app/controllers/conference_registration_controller.rb @@ -42,14 +42,16 @@ class ConferenceRegistrationController < ApplicationController supporter_reg = params[:registration][:supporter_registration_attributes] params[:registration].delete :supporter_registration_attributes registration = person.registrations.new(params[:registration]) - if !supporter_reg[:id].blank? - # This means that their supporter registration was entered ahead of time, probably by an admin - registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id]) - if registration.supporter_registration.email != person.email - raise "Invalid code" + if conference.use_supporter_levels? && !supporter_reg.nil? + if !supporter_reg[:id].blank? + # This means that their supporter registration was entered ahead of time, probably by an admin + registration.supporter_registration = SupporterRegistration.find(supporter_reg[:id]) + if registration.supporter_registration.email != person.email + raise "Invalid code" + end + else + registration.supporter_registration = conference.supporter_registrations.new(supporter_reg) end - else - registration.supporter_registration = conference.supporter_registrations.new(supporter_reg) end registration.conference_id = conference.id