I have written a Rails application which have a db of set of students and that db gets updated on daily basis with the help of a rake task. I mean this task updates entry corresponding to each student id, i.e. first student id 1 then for student id 2 and so on like following.:
task :update_db => :environment do
student_ids = Student.map{|x|x.id}
student_ids.each do |sid|
begin
StudentHelper.update_db_entry(sid)
rescue Exception => e
Rails.logger.info "#{e.message}"
Rails.logger.info "#{e.backtrace.inspect}"
end
end
end
Here entry of a student in the db is independent of other students so it appears that we can update the entry of more than one student at the same time. I think this is only possible with mutithreading.
I am not getting any clue how to proceed, I have no idea how to implement multithreading in ruby on rails application.