From 562fa646c3376ab9959683189380bdcbc38b5f87 Mon Sep 17 00:00:00 2001 From: Larissa Reis Date: Tue, 5 Nov 2013 14:30:20 -0300 Subject: [PATCH] Fixes crash with submissions without profile --- plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb b/plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb index b040a1d..bcb23f6 100644 --- a/plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb +++ b/plugins/custom_forms/controllers/custom_forms_plugin_profile_controller.rb @@ -17,7 +17,7 @@ class CustomFormsPluginProfileController < ProfileController if request.post? begin - raise 'Submission already present!' if CustomFormsPlugin::Submission.find_by_form_id_and_profile_id(@form.id,user.id) + raise 'Submission already present!' if user.present? && CustomFormsPlugin::Submission.find_by_form_id_and_profile_id(@form.id,user.id) # @submission.answers for some reason has the same answer twice failed_answers = answers.select {|answer| !answer.valid? } -- libgit2 0.21.2