Why don't you just set the model up where you find "Teams" and each Team has a collection of Team objects called 'opponents'? It would seem to be a lot easier to me this way.
On Mon, Jul 20, 2009 at 9:07 AM, Älphä Blüë<[email protected]> wrote: > That shows me all the team_ids listed in the schedules table. Now what > if I want to iterate through those team_ids and collect all of their > opponent ids together? This part seems pretty messed up. I think what Marnen and I are trying to say is why not aggregate this more? Why are so determined to work off of "ids" ? In my opinion you should be going through "Team" objects and not ids. And then for any given Team you'd have a nested collection of "opponents" ActiveRecord I'm sure could bring all this back to you in a more OO way. For example, what was wrong with my pseduo code idea: teams.each do |team| val = 0 team.opponents.each do |opponent| if opponent.schedule_id == 121 val += 0.2511 else val += opp_off_tsos[opponent.id] end end end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

