Skip to content

Commit

Permalink
Fix for cascading mailer path being added to template path when using…
Browse files Browse the repository at this point in the history
… partials in email templates

As per padrino#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.
  • Loading branch information
CyberFerret authored and maysam committed Jul 24, 2021
1 parent 070e03d commit a0ad463
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion padrino-mailer/lib/padrino-mailer/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a0ad463

Please sign in to comment.