views:

28

answers:

3

So it turns out mailers hate loop inside of them. So here's my loop.

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

Which returns this went sent through actionmailer in rails 2.3.5 :

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

How would you accomplish this?

+1  A: 

try

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

and watch your white sapce

Jed Schneider
+2  A: 

Problem is with using both for and each. Try this:

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

or this:

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

I don't use haml. Does it need end to close block?

klew
@klew No. One of the great conveniences of Haml is that you don't explicitly close the blocks. You use the white space instead and Haml creates your blocks behind the scenes.
jdl
haml uses significant whitespace to close blocks.
Jed Schneider
Yes Klew, join us. join us klew..
Trip
I can join you on fb ;P
klew
+1  A: 
- ["love", "hate", "war"].each do |f|
  = f
jdl