From 9203dbdb9315455bae7942ab49d91be6c0f45dbe Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 11 Mar 2020 12:01:52 +0800 Subject: [PATCH] fix error for new in admin page --- app/controllers/admin/seminars_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb index a79858e..f3eb263 100644 --- a/app/controllers/admin/seminars_controller.rb +++ b/app/controllers/admin/seminars_controller.rb @@ -321,7 +321,11 @@ class Admin::SeminarsController < OrbitAdminController content[locale] = t("seminar.email_#{field_name}_content") end I18n.locale = now_locale - email_set = @seminar.seminar_email_sets.create(field_name:field_name,title:title,content:content) + if save_flag + email_set = @seminar.seminar_email_sets.create(field_name:field_name,title:title,content:content) + else + email_set = @seminar.seminar_email_sets.new(field_name:field_name,title:title,content:content) + end else email_set = email_set[0] end