I use ruby 1.8.7 and get the params from my form like this:
"cart"=>{"1140229"=>["5"], "1140228"=>["4"], "1140222"=>["7"]}
And, I use rails 2.3 (it's too old, I know it!) which requires this syntax:
1140229 => { :quantity => 5 }, 1140228 => { :quantity => 4 }, 1140222 => { :quantity => 7 }
I use this code to replace params hash:
params[:cart].each{ |k,v| params[:cart][k] = { :quantity => v[0] } }
Cart.update(params[:cart].keys, params[:cart].values)
How can I replace this code in 1.8.7 & 1.9.3 (I'll move my rails app to the new version soon)?