I have a csv file (@fn) with close to 100,000 records (about 50 megs) that I am inserting into a mysql table. For example:
FCSV.foreach(@fn, {:headers => true}) do |row|
model = Model.new(Hash[row])
model.save
end
Back in my ASP days, I could output and print the buffer as html to the users screen durring this loop so as to provide a visual feedback as to how far along the process was. In ruby on rails, is there an equivalent of this approach?
If it helps, I'm using Rails 2.3.9 and Ruby 1.8.7.
I realize there are a dozen ways to accomplish the feedback, such as background jobs, etc. But what I am really wondering about is how to dump and print the buffer to the screen (not the console) with each iteration of the loop.