What do you mean by "doesn't work"? Error? No output? Only one line of
output?
In any case, what <%= %> does is evaluate the Ruby inside it and concatenate
the results onto the erb stream. The block you have specified returns, I
believe, not a concatenation of the partials, but rather the last partial
evaluated.
<% for @item in @items %>
<%= render :partial => 'itemrow' %>
<% end %>
But I was curious as to why the first method doesn't work (at least it
doesn't work for me). Is it not possible to use blocks in views?
What do you mean by "doesn't work"? Error? No output? Only one line of
output?
I think the output will be a single hash-mark for each item in @items,
representing a shortened string representation.
In any case, what <%= %> does is evaluate the Ruby inside it and concatenate
the results onto the erb stream. The block you have specified returns, I
believe, not a concatenation of the partials, but rather the last partial
evaluated.
Actually it returns the original array, @items. The results of the
calls to render are discarded.