Open CyberFerret opened 4 years ago
Sorry to hear about this issue. Unfortunately I don't think we had tested partials in email templates much, or at least I don't recall testing that very much. I could see this being a fairly easy fix. Would be happy to merge in a fix if someone sees this and decides to take a crack at it and open a PR.
In Padrino 0.14.4 running on Ruby 2.5, I am using
partial
to add HAML snippets into emails I am sending out using Mailer.Folder structure is as follows:
So I set up within
worker_mailer.rb
:(Side note: Wish we could use the
locals
declaration within the email block, but it looks like if we are rendering using templates, we have to move thelocals
to a parameter within therender
line?!)Then in the
my_email.haml
template, I have partials within the document like so:However when trying to send the email, I am getting the error:
(Note the duplicated 'worker_mailer' folder in the error message).
If I then try and create a subfolder called 'worker_mailer' under the existing 'worker_mailer' folder and put
_snippet1.haml
in there, then the first line will pass OK, but it throws an error on the next partial with:(Note that the 'worker_mailer' folder appears to be recursively adding to itself for each partial in the template!)
I've tried hard coding the path to the partial template, but with no success. The rendering routine seems to want to keep adding another 'worker_mailer' to the parent folder for each subsequent partial. i.e.:
still doesn't work.
Is this a bug in
rendering.rb
or am I doing something wrong?