blocks in views

Hi, it should be

item | instead of | @item |

Also, I would recommend reading the section of AWDWR on using partials to render collections.

Peace,

-Conrad

Hi --

You *can* -- the syntax is parseable -- but that's not usually what you meant. If you needed an instance variable for a method call, I guess this would make sense, but it still seems strange and an unintentional use of legal syntax.

dblack wrote:

Hi --

dblack wrote:

Actually you can use instance variables as block params. Try this in irb:

   [1,2,3].each {|@x| p @x }

You *can* -- the syntax is parseable -- but that's not usually what you meant. If you needed an instance variable for a method call, I guess this would make sense, but it still seems strange and an unintentional use of legal syntax.

I've done it sometimes when I want to do something like:

   <% @items.each do |@item| %>      <%= text_field "item", "name" %>    <% end %>

It could also come in handy with rendering a partial, as it could save you the trouble of doing a :locals thing.

David