diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 175e92ed..2c84af54 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -29,7 +29,9 @@ def create end - if @org.valid? + legacy_events = params['legacy_legacy_organization']['legacy_events'] + + if legacy_events.present? and @org.valid? @org.legacy_events << Legacy::LegacyEvent.find(params['legacy_legacy_organization']['legacy_events']) @org.save User.where(admin:true).each do |u| @@ -42,9 +44,15 @@ def create redirect_to "/welcome" else - # with errors - flash[:alert] = "The organization name #{@org.name} or email #{@org.email} or contact email has already been taken. Click for Details and Fixes." - render :new + legacy_events = params['legacy_legacy_organization']['legacy_events'] + if not legacy_events.present? + flash[:alert] = "Please select a Disaster." + render :new + else + # with errors + flash[:alert] = "The organization name #{@org.name} or email #{@org.email} or contact email has already been taken. Click for Details and Fixes." + render :new + end end end private