Pit Capitain
3/2/2006 10:37:00 AM
petermichaux@yahoo.com schrieb:
>
> I think this is a pure Ruby question. I seem to be writing this nested
> structure constantly
>
> <% unless item.cart_item_optional_variations.empty? %>
> <% item.cart_item_option_values.each do |ov| %>
>
> <% end %>
> <% end %>
>
> Is there a way to write this in one steps so i am not doing nil.each?
Hi Peter, since empty? isn't a method of NilClass, it seems that your
arrays never are nil, so you can just remove the empty? test.
Regards,
Pit