字符串插值不打印变量值,是打印精确字符串

Joe*_*sey 1 ruby

我有一个看起来像的邮件程序(@user@foo传递给包含方法):

mail(to: @user.email, subject: 'Foo is expired', 
    body: 'Your Foo reservation for #{@foo.bar.name} in position #{@foo.position}
    has expired.  Please recreate the reservation if necessary')
Run Code Online (Sandbox Code Playgroud)

我正在用一些put测试它,把mail.body看起来像:

'Your Foo reservation for #{@foo.bar.name} in position #{@foo.position}
 has expired.  Please recreate the reservation if necessary'
Run Code Online (Sandbox Code Playgroud)

我只是误解了我是如何进行插值的?它与ActionMailer有关,或者输出文本到控制台?

谢谢.

Mur*_*foX 6

字符串插值ruby仅适用于双引号""