Rails - 如何在邮件程序中运行循环?

时间:2010-09-27 16:39:32

标签: ruby-on-rails ruby actionmailer

所以事实证明邮寄者讨厌他们内部的循环。所以这是我的循环。

- for ["love", "hate", "war"].each do |f|
  = f

返回的内容通过rails 2.3.5中的actionmailer发送:

promotion_reminder.html.haml:17: syntax error, unexpected ';', expecting tCOLON2 or '[' or '.'
...ry_temp));}\n", 0, false);end;_hamlout.push_text("      </di...

On line #17 of app/views/notifier/promotion_reminder.html.haml

14:         
15:         - for ["love", "hate", "war"].each do |f|
16:           = f

你将如何实现这一目标?

3 个答案:

答案 0 :(得分:2)

问题在于同时使用foreach。试试这个:

- ["love", "hate", "war"].each do |f|
  = f

或者这个:

- for f in ["love", "hate", "war"] do
  = f

我不使用haml。是否需要end来关闭阻止?

答案 1 :(得分:1)

- ["love", "hate", "war"].each do |f|
  = f

并观察你的空白区域

答案 2 :(得分:1)

- ["love", "hate", "war"].each do |f|
  = f