Hi I am thinking about the design of my application, I understand its crucial to limit the amount of core code from the view.
I seemed to have designed my app in a way found in an online tutorial, and am now encountering a few design issues. For example, my controllers seem to run along these lines: # testruns def run @testcase = Testcase.find(:all) @testsuite = Testsuite.find(params[:id]) @version = Version.find(params[:id1]) @testruns = Testrun.find(:all) @testrun = Testrun.find(:all).last.id end and the view: <% @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> <td align="left"><b><%= tc.description -%></b></td> <td align="left"><b><%= debug Result.find_by_resulttype(:all, :conditions => {:id => [1]}) %></b></td> <td align="left"><b><%= @outcome.outcome_date %></b></td> </tr> <% end %> The problem is, now I have to write some more detailed queries, like this for example: @passed = Outcome.count(:all, :conditions => 'outcomes.outcome_date = (select max(o2.outcome_date) from outcomes o2 where o2.testrun_id = outcomes.testrun_id and o2.testcase_id = outcomes.testcase_id and outcomes.testrun_id = @testrun and outcomes.testcase_id = tc.id)') In the above the @testrun is set in the controller, and tc.id is iterated through in the each do loop. But the @passed query, is coded into the view, this obviously should be a speerated concern from the view and in the controller, but I cant figure out how to transfer the loop, because I need the tc.id into the controller, and then pass the values across to the view as it iterates. Can anyone help? Can you give me a few pointers, to be honest I am a newbie, and have hacked out some code, Im going to start the agile programming ruby book this weekend, but most of the functional lines of that book seem to be for useless design, things I dont really have interest in developing, but I suppose the principles are still worth learning. Are there any other areas of study you would recommend? Thanks... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---