From dfeb4285d37943a2aea6feccc2ff577b636ae5be Mon Sep 17 00:00:00 2001 From: Devan Date: Sun, 11 Oct 2020 13:25:00 +0930 Subject: [PATCH] Fix for cascading mailer path being added to template path when using partials in email templates As per #2231, when using multiple partials within an email template, the mailer name keeps getting added to the file path for each subsequent partial in the same template, resulting in an `Errno::ENOENT: No such file or directory @ rb_sysopen` error. Added a check to `settings.view` in the render routine to see if the mailer path was already in the string before adding it. --- padrino-mailer/lib/padrino-mailer/ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/padrino-mailer/lib/padrino-mailer/ext.rb b/padrino-mailer/lib/padrino-mailer/ext.rb index 9789aa184..23c4c6d52 100644 --- a/padrino-mailer/lib/padrino-mailer/ext.rb +++ b/padrino-mailer/lib/padrino-mailer/ext.rb @@ -261,7 +261,7 @@ def render(engine=nil, data=nil, options={}, locals={}, &block) engine ||= message_name if mailer_name && !engine.to_s.index('/') - settings.views += "/#{mailer_name}" + settings.views += "/#{mailer_name}" unless settings.views.include?("/#{mailer_name}") engine = engine.to_s.sub(%r{^#{mailer_name}/}, '') end