Thanks guys.
I changed it to:
def recalculate_totals
fields = 5.0
self.totals = ((self.kickret + self.puntret + self.netpunt +
self.kickretdef + self.puntretdef) / fields).round_to(4)
end
and..
model.compiled_this_week.all.each do |row|
row.recalculate_totals
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
-~----------~----~----~----~------~----~------~--~---