Okay, so I figured out what I was doing wrong. This method:
def calculate_tsos(model, datavar, teamvar, valvar) var = model.compiled_this_week.find(:all) var.each_with_index do |rows, i| teamvar[i] = rows.team.id valvar[i] = rows.__send__(datavar) puts "#{model} [ Row #{i} | Team ID = #{teamvar[i]} | Team = #{rows.team.name} | #{datavar} = #{valvar[i]}" end end .. works fine .. The problem was I forgot to pass empty arrays with the method variables in my rake file: to_team_id = [] to_value = [] update_tsos_offense = TsosOffense.new update_tsos_offense.calculate_tsos(TotalOffense, "ydspgm", to_team_id, to_value) However, even doing this, I would like some feedback. Should I be doing it this way or is there an easier way with what I'm trying to accomplish? Many thanks in advance. -- 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 -~----------~----~----~----~------~----~------~--~---