HeppokoNeet
HeppokoNeet

Reputation: 137

Can't make a new line in slim template

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: "[email protected],
      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?

Upvotes: -2

Views: 55

Answers (1)

HeppokoNeet
HeppokoNeet

Reputation: 137

I lacked .html_safe.
fixed code is the below.

test.slim

= @summaries.map { |summary| summary }.join("\n").html_safe

Upvotes: -1

Related Questions