On Sep 23, 2008, at 12:02 PM, Brad Symons wrote:
>> 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
[EMAIL PROTECTED]
+1 513-295-4739
Skype:  rob.biedenharn



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to