From db0937d1eb58a98e8af6dc65158c9eaaf9c11755 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Fri, 16 Mar 2018 18:32:43 +0100 Subject: [PATCH] [#1563] Allow default template name to depend on procedure --- app/models/concerns/mail_template_concern.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/mail_template_concern.rb b/app/models/concerns/mail_template_concern.rb index ad455cd4b..107451969 100644 --- a/app/models/concerns/mail_template_concern.rb +++ b/app/models/concerns/mail_template_concern.rb @@ -13,9 +13,14 @@ module MailTemplateConcern module ClassMethods def default_for_procedure(procedure) - body = ActionController::Base.new.render_to_string(template: const_get(:DEFAULT_TEMPLATE_NAME)) + template_name = default_template_name_for_procedure(procedure) + body = ActionController::Base.new.render_to_string(template: template_name) new(subject: const_get(:DEFAULT_SUBJECT), body: body, procedure: procedure) end + + def default_template_name_for_procedure(procedure) + const_get(:DEFAULT_TEMPLATE_NAME) + end end def dossier_tags