Displaying 2 results from an estimated 2 matches for "totaloffense".
2009 Jul 16
9
Please help me understand how arrays are translated in rails
...ef calculate_tsos(model, datavar, teamvar, valvar)
var = model.compiled_this_week.find(:all)
var.each_with_index do |rows, i|
puts "#{model} [ Row #{i} | Team ID = #{rows.team_id} | Team =
#{rows.team.name} | #{datavar} = #{rows.__send__(datavar)}"
end
end
This will give me:
TotalOffense [ Row 0 | Team ID = 5 | Team = Tulsa | ydspgm = 569.86
TotalOffense [ Row 1 | Team ID = 47 | Team = Houston | ydspgm = 562.77
TotalOffense [ Row 2 | Team ID = 20 | Team = Oklahoma | ydspgm = 547.86
etc. etc.
So far, so good. I can at least see the data that I want.
Now, I want to assign the Team...
2009 Jul 17
19
I need help saving table data from a rake task
...to find out how I can create and save a large dataset to a table
based on multiple returned arrays from a Rake task.
Here is my example using just two arrays (there are 14 in this
particular rake task):
update_tsos_offense = TsosOffense.new
to_team_id, to_ppcs = update_tsos_offense.calculate_tsos(TotalOffense,
"ydspgm", "desc")
ro_team_id, ro_ppcs = update_tsos_offense.calculate_tsos(RushingOffense,
"ydspg", "desc")
This task starts with creating a new object (TsosOffense) which is the
model that houses the table I will eventually write/save data to.
It then cal...