You are still getting all the indentation from the iterations that are  
skipped (i.e., where the currency is not USD).

<% for currency in @rates -%>
   <% next unless currency[2] == 'USD' -%>
   <%= currency[2] %> ............... <%= currency[4] %>
<% end -%>

I'm not sure you need the minus sign on an emitting tag (<%=) to  
suppress the linefeed.

Does this help?



On Apr 30, 2009, at 11:49 AM, James Byrne wrote:

>
> I am attempting to generate a plain text list from an array of arrays.
>
> If I do this:
>
> <% for currency in @rates -%>
>  <% if currency[2] == 'USD' -%>
>     <%= currency[2] -%> ............... <%= currency[4] %>
>  <% end -%>
> <% end -%>
>
> Then I see this:
>
>                                                                         =
>                                  USD ............... 1.203804
>              =
>
> If I do this:
>
> <% for currency in @rates -%>
>     <%= currency[2] -%> ............... <%= currency[4] %>
> <% end -%>
>
> Then I see this:
>
>     AED ............... 0.327697
>     ANG ............... 0.6879
>     ARS ............... 0.324296
>     AUD ............... 0.869868
>
> How is the if statement causing the difference?
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to