Hi Fred,
Yeah I'm stuck with this one. I've checked the documentation but I'm
just not following it.
What I basically need it to do is to update the table with the data
that's parsed into @rows.
In this case @rows is listed by:
offensive_rushing.rows[i][1] (:name)
offensive_rushing.rows[i][2] (:games)
I was trying to do a for loop to go through all of the rows and send the
new data to the database. I'm just not sure how to do it properly. I
catch on quick but I've been searching the web and reading the
documentation and I just don't see a very detailed model for what I'm
trying to do.
So, in a readability format what I see is:
for i in 0..offensive_rushing.numrows-1
--> starting my loop and it's going to repeat approx 120 times (120
teams)
puts "Updating Team Name = #{offensive_rushing.rows[i][1]}."
--> Print me out an update to show me that you are updating the teams
RushingOffense.update_all(:name => offensive_rushing.rows[i][1],
:games => offensive_rushing.rows[i][2])
--> Update the :name with the name of the team
--> Update the :games with the number of games that team has played
--> Update it if the team already exists (not sure how to do this part)
--> Add new data if the team doesn't exist (don't know how to do this
part)
I hope that helps..
--
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
-~----------~----~----~----~------~----~------~--~---