Reputation: 9767
I'm using \n
and they are showing up as literal \n
class TestMailer < ActionMailer::Base
def simple_mail(to, subject, body)
mail(:to => to, :subject => subject, :body => body)
end
end
TestMailer.simple_mail('[email protected]', 'subject', 'hi\n there').deliver
I see the literal \n
in my inbox.
Upvotes: 1
Views: 1748
Reputation: 1243
Single quotes only allow you to escape ' and \ within a string. For example
puts 'That\'s all folks'
puts 'This is a single backslash \\'
Whereas double quotes allow you to escape many more escape sequences. They also allow you to embed variables inside of a string literal using interpolation.
Some of the escape sequences available for double quotes include:
Upvotes: 3
Reputation: 168101
Use "hi\n there"
instead of 'hi\n there'
. Still better, use "hi#$/ there"
.
Upvotes: 0