I have a hash which has in excess of a thousand key/value pairs.
I have a database table with several thousand rows.
So to brute-force an update of the table based on the hash is pretty simple. e.g. :
my_hash.each{|key,value|
Model.update_all("column2 = #{value}", "column1 = #{key}")
}
But this will do over a thousand SQL update statements.
Is there any good way (in Rails) to do this with one (or just a few) update statements?