Test One:

week_start_date =Time.now.beginning_of_week.to_date.strftime('%Y-%m-%d')
week_end_date = Time.now.end_of_week.to_date.strftime('%Y-%m-%d')
compiled_on = week_start_date..week_end_date
tsos_offense = Team.find(10,1, :joins => [:tsos_offenses], :conditions 
=> {:tsos_offenses => {:compiled_on => compiled_on}}, :order => 
"teams.id")

Pull Data:

tsos_offense[0].tsos_offenses[0]

=> #<TsosOffense id: 1081, team_id: 1, totoff: 45.74, rushoff: 201.6, 
passoff: 0.63, scoroff: 83.79, rzonoff: 174.72, fumlost: 60.48, 
passhint: 201.6, tolost: 186.48, sacksall: 199.92, tackflossall: 193.2, 
passeff: 102.06, firdwns: 24.95, thrdwncon: 133.56, fthdwncon: 118.44, 
totals: 123.369, compiled_on: "2009-08-03", created_at: "2009-08-03 
19:02:11", updated_at: "2009-08-03 19:02:12">

First Team found

tsos_offense[1].tsos_offenses[1]

=> nil

This code was working yesterday.

Now it appears that:

tsos_offense[1].tsos_offenses[0]

=> #<TsosOffense id: 1090, team_id: 10, totoff: 118.42, rushoff: 139.86, 
passoff: 49.9, scoroff: 165.53, rzonoff: 189.84, fumlost: 118.44, 
passhint: 201.6, tolost: 196.56, sacksall: 181.44, tackflossall: 179.76, 
passeff: 196.56, firdwns: 119.7, thrdwncon: 143.64, fthdwncon: 138.6, 
totals: 152.846, compiled_on: "2009-08-03", created_at: "2009-08-03 
19:02:11", updated_at: "2009-08-03 19:02:12">

pulls the second team.

Why would tsos_offense[1].tsos_offenses[1] work on one compile and on 
another day tsos_offense[1].tsos_offenses[0] works?

I even checked my views.  For two weeks I've been using [1][1] pairings 
for the second team and now [1][0] is the correct pairing?

Am I better off going with a select?  I don't like how the behavior is 
working with this.
-- 
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 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to