Displaying 2 results from an estimated 2 matches for "calculate_tso".
Did you mean:
calculate_tsos
2009 Jul 16
9
Please help me understand how arrays are translated in rails
...n IRB, and rails console but I''m just having trouble making
headway into what is probably a very easy subject.
I understand arrays with at least 4 other languages but with Ruby I
haven''t found a mental connection with how I can assign variables to
arrays..
Take for example:
def 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 [ R...
2009 Jul 17
19
I need help saving table data from a rake task
I need 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...