My code is the below.
mails_preview.rb
summaries = ["test\ntest\ntest\ntest", "test\ntest\ntest\ntest"]
ClientsMailer.test(summaries)
clients_mailer.rb
class ClientsMailer < ApplicationMailer
def test(summaries)
@summaries = summaries
mail(
to: "test@test.com,
subject: "test",
)
end
end
test.slim
= @summaries.map { |summary| summary }.join("\n")
Output is here
test test test test test test test test
\n doesn't work for making a new line.
I can't understand why.
Do you have any ideas?
I lacked .html_safe
.
fixed code is the below.
test.slim
= @summaries.map { |summary| summary }.join("\n").html_safe