Ignoring the presence of so much code in a view>>
yes i totally agree, but i cant quite figure out how to keep it in the
controller.
because i need to use the tc.id, thats taken from the following loop
<% @testsuite.testcases.each do |tc| %>
<tr>
<td align="left"><b><%= link_to tc.number, {:controller =>
'testrun', :action => 'runtest', :id => tc.id, :id1 => @testrun, :id2 =>
@testsuite.id, :id3 => @version } -%> </b></td>
</tr>
<% end %>
<%= render :partial => 'testcase', :collection => @testsuite.testcases %>
in app/views/{controller}/_testcase.rhtml
<tr>
<td align="left"><b><%= link_to testcase.number, {:controller => 'testrun', :action => 'runtest', :id => testcase.id, :id1 => @testrun, :id2 => testcase.testsuite_id, :id3 => @version } %></b></td>
<td><%=h testcase.description %></td>
<td><%=h testcase.status %></td>
<td><%=h testcase.last_run %></td>
</tr>
If @testrun is an attribute of a testcase or testsuite, it should be referenced that way.
any suggestions would be great, basically its iterating over a list.
test.rhtml
(tc.id)
\
TC# DESC STATUS LAST RUN
1
2
3
controller.rb
@testcase = Testcase.find(:all)
@testsuite = Testsuite.find(params[:id])
Shouldn't @testcase be plural? And if you really mean @testsuite.testcases, it doesn't need to be its own instance variable.
-Rob
Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
+1 513-295-4739
Skype: rob.biedenharn