Hi Craig,
Did you mean something like this?
Both methods are in the model..
def recalculate_totals(row)
fields = 5.0
row.totals = ((row.kickret + row.puntret + row.netpunt +
row.kickretdef + row.puntretdef) / fields).round_to(4)
end
model.compiled_this_week.all.each do |row|
row.recalculate_totals(row)
row.save!
puts "Team = #{row.team.name} and total val = #{row.totals}."
end
--
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 [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
-~----------~----~----~----~------~----~------~--~---