This only works when the partial name matches the object name; if I
change “threadtop” to “thread” then it works fine. Is this normal? I
get the following error otherwise:
“undefined local variable or method `thread’”
index.rhtml
<% for @thread in @threads %>
<%= render :partial => ‘threadtop’, :object => @thread %>
<% for @reply in @replies %>
<%= render :partial => “reply”, :object => @reply %>
<% end %>
<% end %>
_threadtop.rhtml:
<%= thread.subject %> <%= thread.name %> <%= thread.date.strftime("%m/%d/%Y %H:%M") %> No. <%= thread.num %> [<%= link_to "Reply", :controller => ["imageboard", params[:board]], :action => ["reply"], :id => thread.num %>]
<% if thread.comment != “” %>
<%= thread.comment %><% end %>