You've forgotten to close your for loop.  The error comes after the  
last line because thats the last place it was trying to find your <%  
end % >.

You'd probably gain some more incite into rhtml on the rails list  
http://groups.google.com/group/rubyonrails-talk .